CSES - Datatähti Open 2017 - Results
Submission details
Task:Family reunion
Sender:cuber2460
Submission time:2017-01-21 20:53:00 +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>
using namespace std;

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

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;
	}
	
	for(int i = 1; i < 2 * k; ++i) {
		if(t[i] > t[i - 1] && t[i] > t[i + 1]) res[i] = 'A';
		if(t[i] < t[i - 1] && t[i] < t[i + 1]) res[i] = 'B';
	}
	
	for(int i = 1; i < 2 * k; ++i) {
		if(!res[i]) {
			if(t[i - 1] < t[i]) {
				if(res[i - 1] == 'B') {
					if(res[i + 1] == 'A') res[i] = 'C';
					else res[i] = 'A';
				}
				else if(res[i - 1] == 'A') {
					res[i] = 'B';
				}
			}
		}
	}
	
	for(int i = 2 * k - 1; i > 0; --i) {
		if(!res[i]) {
			if(t[i + 1] < t[i]) {
				if(res[i + 1] == 'B') {
					if(res[i - 1] == 'A') res[i] = 'C';
					else res[i] = 'A';
				}
				else if(res[i + 1] == 'A') {
					res[i] = 'B';
				}
			}
		}
	}
	
	if(!res[k]) res[k] = 'A' + (rand() % 3);
	
	cout << res[k] << 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)