Submission #52058

# Submission time Handle Problem Language Result Execution time Memory
52058 2018-06-23T12:19:54 Z Alexa2001 Carnival (CEOI14_carnival) C++17
100 / 100
20 ms 572 KB
#include <bits/stdc++.h>

using namespace std;
/// 15:08

const int Nmax = 155;
int n, i, x, C=0, a[Nmax], cnt[Nmax];

int bs(int id)
{
    int st, dr, mid, x, j;
    st = 1, dr = id-1;

    while(st <= dr)
    {
        mid = (st+dr)/2;

        cout << mid+1 << ' ';
        for(j=1; j<=mid; ++j) cout << j << ' ';
        cout << id << '\n';
        fflush(stdout);

        cin >> x;
        if(x != cnt[mid]) st = mid+1;
            else dr = mid-1;
    }

    return a[st];
}

int main()
{
    cin >> n;
    for(i=1; i<=n; ++i)
    {
        x = bs(i);
        if(x) a[i] = x;
            else a[i] = ++C;
        cnt[i] = C;
    }

    cout << 0;
    for(i=1; i<=n; ++i) cout << ' ' << a[i];
    cout << '\n';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 376 KB Output is correct
2 Correct 12 ms 376 KB Output is correct
3 Correct 11 ms 388 KB Output is correct
4 Correct 9 ms 428 KB Output is correct
5 Correct 8 ms 572 KB Output is correct
6 Correct 7 ms 572 KB Output is correct
7 Correct 10 ms 572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 572 KB Output is correct
2 Correct 7 ms 572 KB Output is correct
3 Correct 9 ms 572 KB Output is correct
4 Correct 12 ms 572 KB Output is correct
5 Correct 8 ms 572 KB Output is correct
6 Correct 6 ms 572 KB Output is correct
7 Correct 9 ms 572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 572 KB Output is correct
2 Correct 6 ms 572 KB Output is correct
3 Correct 11 ms 572 KB Output is correct
4 Correct 10 ms 572 KB Output is correct
5 Correct 9 ms 572 KB Output is correct
6 Correct 13 ms 572 KB Output is correct
7 Correct 10 ms 572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 572 KB Output is correct
2 Correct 9 ms 572 KB Output is correct
3 Correct 15 ms 572 KB Output is correct
4 Correct 14 ms 572 KB Output is correct
5 Correct 10 ms 572 KB Output is correct
6 Correct 11 ms 572 KB Output is correct
7 Correct 12 ms 572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 572 KB Output is correct
2 Correct 7 ms 572 KB Output is correct
3 Correct 20 ms 572 KB Output is correct
4 Correct 14 ms 572 KB Output is correct
5 Correct 14 ms 572 KB Output is correct
6 Correct 12 ms 572 KB Output is correct
7 Correct 20 ms 572 KB Output is correct