CSES - Datatähti Open 2017 - Results
Submission details
Task:Family reunion
Sender:cuber2460
Submission time:2017-01-21 21:36:07 +0200
Language:C++
Status:READY
Result:19
Feedback
groupverdictscore
#1UNKNOWN0
#2UNKNOWN0
#3UNKNOWN0
Test results
testverdicttimegroup
#1UNKNOWN--1details
#2UNKNOWN--2details
#3UNKNOWN--3details

Code

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;

int n, m, k;
int t[107];
int res[107];
int A = 854971895;
int B = 150918510;
int per[100007];

int main() {
	ios_base::sync_with_stdio(0);
	srand(5718);
	cin >> n >> m >> k;
	for(int i = 0; i <= 2 * k; ++i) {
		cin >> t[i];
		t[i]--;
		long long pom = t[i];
		pom *= A;
		pom += B;
		pom %= n;
		t[i] = pom;
	}
	
	if(n <= 100000) {
		for(int i = 0; i < n; ++i) per[i] = i;
		random_shuffle(per, per + n);
		
		for(int i = 0; i <= 2 * k; ++i) t[i] = per[t[i]];	
	}
	
	for(int i = 0; i < 2 * k; ++i) {
		if(t[i] % 2 == 0 && t[i + 1] % 2 == 1) res[i] = 1;
	}
	
	if(res[k]) cout << 'A' << endl;
	else {
		int x = -10;
		int y = 2 * k + 10;
		for(int i = 0; i < k; ++i) if(res[i]) x = i;
		for(int i = 2 * k; i > k; --i) if(res[i]) y = i;
		
		y = y - k;
		x = k - x;
		if(y < x) {
			if(y + 1 == x) cout << 'C' << endl;
			else {
				if(y % 2 == 1) cout << 'B' << endl;
				else cout << 'A' << endl;
			}
		}
		else {
			if(x % 2 == 1) cout << 'B' << endl;
			else cout << 'A' << endl;
		}
	}
	return 0;
}

Test details

Test 1

Group: 1

Verdict: UNKNOWN

input
#!/bin/bash
set -e
OFFSET=$(grep -onam1 '^__DATA_...

correct output
50

user output
(not available)

Test 2

Group: 2

Verdict: UNKNOWN

input
#!/bin/bash
set -e
OFFSET=$(grep -onam1 '^__DATA_...

correct output
50

user output
(not available)

Test 3

Group: 3

Verdict: UNKNOWN

input
#!/bin/bash
set -e
OFFSET=$(grep -onam1 '^__DATA_...

correct output
50

user output
(not available)