CSES - Datatähti Open 2017 - Results
Submission details
Task:Family reunion
Sender:Kaban-5
Submission time:2017-01-20 18:12:32 +0200
Language:C++
Status:READY
Result:19
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;
    assert(m == 1 && 2 * k + 1 == n - 1);
    vi v(2 * k + 1);
    forn (i, sz(v))
    {
        cin >> v[i];
        --v[i];
    }
    const int who = v[k];

    vector<char> used(n);
    for (int i : v) used[i] = 1;
    int pos = find(ALL(used), 0) - used.begin();
    assert(pos != n);
    v.pb(pos);
    int where0 = find(ALL(v), 0) - v.begin();
    assert(where0 != sz(v));
    rotate(v.begin(), v.begin() + where0, v.end());
    assert(v[0] == 0);
    int our = find(ALL(v), who) - v.begin();
    assert(our != sz(v));
    cout << (char)('A' + (our % 2)) << endl;
}

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)