Submission #693617

# Submission time Handle Problem Language Result Execution time Memory
693617 2023-02-03T05:56:30 Z ojuzuser12 Carnival (CEOI14_carnival) C++17
100 / 100
28 ms 300 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int N, C = 0; cin >> N;
    vector<int> costume(N + 1, -1);
    for(int i = 1; i <= N; i++) {
        if(costume[i] == -1) {
            C++;
            costume[i] = C;
        }
        int l = i + 1, r = N, mid, pos = N + 1;
        while(l <= r) {
            mid = (l + r) / 2;
            cout << (mid - i + 1);
            for(int j = i; j <= mid; j++) {
                cout << ' ' << j;
            }
            cout << '\n';
            cout.flush();
            int a; cin >> a;
            cout << (mid - i);
            for(int j = i + 1; j <= mid; j++) {
                cout << ' ' << j;
            }
            cout << '\n';
            cout.flush();
            int b; cin >> b;
            if(a == b) {
                pos = min(pos, mid);
                r = mid - 1;
            } else {
                l = mid + 1;
            }
        }
        if(pos != N + 1) {
            costume[pos] = costume[i];
        }
    }
    cout << 0;
    for(int i = 1; i <= N; i++) {
        cout << ' ' << costume[i];
    }
    cout << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 16 ms 208 KB Output is correct
2 Correct 18 ms 208 KB Output is correct
3 Correct 23 ms 208 KB Output is correct
4 Correct 27 ms 208 KB Output is correct
5 Correct 15 ms 208 KB Output is correct
6 Correct 15 ms 208 KB Output is correct
7 Correct 24 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 208 KB Output is correct
2 Correct 16 ms 208 KB Output is correct
3 Correct 14 ms 208 KB Output is correct
4 Correct 23 ms 208 KB Output is correct
5 Correct 13 ms 208 KB Output is correct
6 Correct 15 ms 208 KB Output is correct
7 Correct 17 ms 276 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 208 KB Output is correct
2 Correct 14 ms 208 KB Output is correct
3 Correct 18 ms 208 KB Output is correct
4 Correct 22 ms 208 KB Output is correct
5 Correct 17 ms 208 KB Output is correct
6 Correct 17 ms 208 KB Output is correct
7 Correct 21 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 208 KB Output is correct
2 Correct 17 ms 208 KB Output is correct
3 Correct 24 ms 208 KB Output is correct
4 Correct 28 ms 208 KB Output is correct
5 Correct 16 ms 208 KB Output is correct
6 Correct 20 ms 208 KB Output is correct
7 Correct 19 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 208 KB Output is correct
2 Correct 20 ms 208 KB Output is correct
3 Correct 16 ms 208 KB Output is correct
4 Correct 23 ms 208 KB Output is correct
5 Correct 19 ms 208 KB Output is correct
6 Correct 20 ms 208 KB Output is correct
7 Correct 22 ms 208 KB Output is correct