Submission #114042

# Submission time Handle Problem Language Result Execution time Memory
114042 2019-05-29T17:33:23 Z dolphingarlic Carnival (CEOI14_carnival) C++14
100 / 100
17 ms 428 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#define FOR(i, x, y) for(ll i = x; i < y; i++)
typedef long long ll;
using namespace std;

ll a[151];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n, id = 1;
    cin >> n;
    
    vector<ll> v;
    FOR(i, 1, n + 1) {
        cout << id << ' ';
        for (auto& j : v) cout << j << ' ';
        cout << i << endl;
        ll x;
        cin >> x;
        if (x == id) {
            a[i] = id++;
            v.push_back(i);
        } else {
            ll l = 0, r = v.size() - 1;
            while (l != r) {
                ll mid = (l + r - 1) / 2;
                cout << mid - l + 2 << ' ' << i << ' ';
                FOR(j, l, mid + 1) cout << v[j] << ' ';
                cout << endl;
                ll k;
                cin >> k;
                if (k == mid - l + 1) r = mid;
                else l = mid + 1;
            }
            a[i] = a[v[l]];
        }

    }

    cout << "0 ";
    FOR(i, 1, n + 1) cout << a[i] << ' ';
    cout << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 8 ms 256 KB Output is correct
2 Correct 9 ms 384 KB Output is correct
3 Correct 4 ms 424 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 6 ms 256 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 17 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 10 ms 256 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 5 ms 384 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 7 ms 384 KB Output is correct
3 Correct 7 ms 256 KB Output is correct
4 Correct 4 ms 384 KB Output is correct
5 Correct 3 ms 256 KB Output is correct
6 Correct 6 ms 428 KB Output is correct
7 Correct 6 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 6 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 4 ms 256 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 6 ms 384 KB Output is correct
7 Correct 7 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 10 ms 384 KB Output is correct
3 Correct 4 ms 424 KB Output is correct
4 Correct 6 ms 420 KB Output is correct
5 Correct 6 ms 384 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 4 ms 336 KB Output is correct