CSES - Datatähti Open 2017 - Results
Submission details
Task:Family reunion
Sender:Kaban-5
Submission time:2017-01-20 19:56:14 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#1UNKNOWN0
#2UNKNOWN0
#3UNKNOWN0
Test results
testverdicttimegroup
#1UNKNOWN--1details
#2UNKNOWN--2details
#3UNKNOWN--3details

Code

//#define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fst first
#define snd second
#define forn(i, n) for (int i = 0; i < int(n); ++i)
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef pair<int, int> pii;
typedef vector<pii> vii;
#define sz(c) (int)(c).size()
#define ALL(c) (c).begin(), (c).end()

void solve (int n)
{
    int m, k;
    cin >> m >> k;

    vi v(2 * k + 1);
    forn (i, sz(v))
    {
        cin >> v[i];
        v[i]--;
    }

    mt19937 rng;
    int c = -1;
    while (true)
    {
        c = rng() % (n - 1) + 1;
        if (__gcd(c, n) == 1)
            break;
    }

    int a = -1;
    if (n == 16)
        a = 9;
    else
        a = 20 * (rng() % (n / 20)) + 1;

    forn (i, sz(v))
        v[i] = ((ll)a * (ll)v[i] + (ll)c) % n;

    int lst = -1;
    forn (i, sz(v) - 2) if (v[i] > v[i + 1])
        lst = i;

    if (lst != -1)
        cout << (char)('A' + (lst % 3)) << '\n';
    else
        cout << (char)('A' + (rng() % 3)) << '\n';
}

int main()
{
    #ifndef ONLINE_JUDGE
    //freopen("input.txt", "rt", stdin);
    //freopen("output.txt", "w", stdout);
    #endif // ONLINE_JUDGE

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    while (cin >> n)
        solve(n);
}

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)