Submission #753761

# Submission time Handle Problem Language Result Execution time Memory
753761 2023-06-06T00:41:46 Z vjudge1 Carnival (CEOI14_carnival) C++17
100 / 100
14 ms 2688 KB
#include<bits/stdc++.h>

#define MaxN 100005

using namespace std;


int n;
vector<int> cLis[MaxN];
int ans[MaxN];


int main() {
    cin >> n;


    for(int c = 1; c <= n; ++c) cLis[c].clear();
    for(int i = 1; i <= n; ++i) ans[i] = -1;


    int cnt = 1;
    cLis[1].push_back(1);
    ans[1] = 1;
    for(int i = 2; i <= n; ++i) {
        int lo = 1, hi = cnt, pos = -1;
        while(lo <= hi) {
            int k = 1, mi = (lo+hi)/2;
            cout << mi-lo+1 + 1 << " " << i << " ";
            for(int c = lo; c <= mi; ++c) cout << cLis[c][0] << " ";
            cout << "\n";
            cin >> k;
            if (k > mi-lo+1) {
                lo = mi+1;
            }
            else {
                pos = mi;
                hi = mi-1;
            }
        }
        if (pos == -1) {
            ++cnt;
            cLis[cnt].push_back(i);
            ans[i] = cnt;
        }
        else {
            cLis[pos].push_back(i);
            ans[i] = pos;
        }
    }


    cout << "0 ";
    for(int i = 1; i <= n; ++i) cout << ans[i] << " ";
    cout << "\n";


    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 2640 KB Output is correct
2 Correct 14 ms 2640 KB Output is correct
3 Correct 10 ms 2640 KB Output is correct
4 Correct 8 ms 2640 KB Output is correct
5 Correct 4 ms 2640 KB Output is correct
6 Correct 2 ms 2640 KB Output is correct
7 Correct 7 ms 2640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 2640 KB Output is correct
2 Correct 8 ms 2652 KB Output is correct
3 Correct 8 ms 2640 KB Output is correct
4 Correct 11 ms 2656 KB Output is correct
5 Correct 4 ms 2640 KB Output is correct
6 Correct 5 ms 2640 KB Output is correct
7 Correct 5 ms 2656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2688 KB Output is correct
2 Correct 6 ms 2656 KB Output is correct
3 Correct 8 ms 2640 KB Output is correct
4 Correct 10 ms 2640 KB Output is correct
5 Correct 7 ms 2640 KB Output is correct
6 Correct 7 ms 2640 KB Output is correct
7 Correct 8 ms 2652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 2640 KB Output is correct
2 Correct 4 ms 2640 KB Output is correct
3 Correct 10 ms 2660 KB Output is correct
4 Correct 9 ms 2640 KB Output is correct
5 Correct 8 ms 2640 KB Output is correct
6 Correct 13 ms 2660 KB Output is correct
7 Correct 10 ms 2640 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 2620 KB Output is correct
2 Correct 8 ms 2640 KB Output is correct
3 Correct 10 ms 2640 KB Output is correct
4 Correct 11 ms 2652 KB Output is correct
5 Correct 10 ms 2640 KB Output is correct
6 Correct 10 ms 2640 KB Output is correct
7 Correct 11 ms 2656 KB Output is correct