CSES - Datatähti 2018 loppu - Results
Submission details
Task:Merkkijono
Sender:Yytsi
Submission time:2018-01-18 15:40:07 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttime
#10.04 sdetails
#20.04 sdetails
#30.04 sdetails
#40.05 sdetails
#50.04 sdetails

Code

#include <iostream>
#include <utility>

using namespace std;

#define N 100001
int p[N];
pair<int, int> inp[N];

int main() {
	ios_base::sync_with_stdio(0); cin.tie(0);
	int n; cin >> n; cin.ignore();
	int k = (n / 2) + 1;
	
	for (int i = 0; i < k; i++) {
		int a, b; cin >> a >> b; cin.ignore();
		p[a]++;
		p[b]++;
		inp[i] = make_pair(a, b);
	}
	
	for (int i = 0; i < k; i++) {
		pair<int,int> L = inp[i];
		int a = L.first,b=L.second;
		p[a]--; p[b]--;
		if (p[a] == 1 || p[b] == 1) {
			cout << a <<" " << b;
			break;
		}
	}
	
	return 0;
}

Test details

Test 1

Verdict:

input
ABCDEFGHIJKLMNOPQRSTUVWXYZ

correct output
0

user output
(empty)

Test 2

Verdict:

input
ZYXWVUTSRQPONMLKJIHGFEDCBA

correct output
923
MOVE
MOVE
SWAP
MOVE
...

user output
(empty)

Test 3

Verdict:

input
RPJMFWBHYQOTXUAENLDGZISCVK

correct output
611
SWAP
MOVE
MOVE
SWAP
...

user output
(empty)

Test 4

Verdict:

input
GWJSPBHANMXYFLKIDORVUCEZQT

correct output
659
MOVE
SWAP
MOVE
SWAP
...

user output
(empty)

Test 5

Verdict:

input
BJYNFLKEIUCZMQHRAXOGWPSDTV

correct output
624
MOVE
SWAP
MOVE
SWAP
...

user output
(empty)