Submission #918248

# Submission time Handle Problem Language Result Execution time Memory
918248 2024-01-29T13:49:28 Z TahirAliyev Carnival (CEOI14_carnival) C++17
100 / 100
12 ms 596 KB
#include <bits/stdc++.h>
#include <iostream>

using namespace std;

#define ll long long
#define pii pair<ll, ll>
#define oo 1e9

int n;

int main(){
    cin >> n;
    int ans[n + 1];
    vector<int> v;
    ans[1] = 1;
    cout << n << ' ';
    for(int i = 1; i <= n; i++){
        cout << i << ' ';
    }
    cout << endl;
    int C; cin >> C;
    int c = 1;
    for(int i = 2; i <= n; i++){
        cout << i << ' ';
        for(int j = 1; j <= i; j++){
            cout << j << ' ';
        }
        cout << endl;
        int tmp; cin >> tmp;
        if(tmp != c){
            ans[i] = ++c;
            continue;
        }

        int l = 1, r = i - 1;
        while(l < r){
            int mid = (l + r) / 2;
            cout << mid - l + 1 << ' ';
            for(int j = l; j <= mid; j++){
                cout << j << ' ';
            }
            cout << endl;
            int a; cin >> a;
            cout << mid - l + 2 << ' ';
            for(int j= l; j <= mid; j++){
                cout << j  << ' ';
            }
            cout << i << ' ';
            cout << endl;
            int b; cin >> b;
            if(a == b){
                r = mid;
            }
            else{
                l = mid + 1;
            }
        }
        ans[i] = ans[l];
    }
    cout << "0 ";
    for(int i = 1; i <= n; i++){
        cout << ans[i] << ' ';
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 344 KB Output is correct
2 Correct 6 ms 344 KB Output is correct
3 Correct 4 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 8 ms 344 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 7 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 344 KB Output is correct
2 Correct 8 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 9 ms 344 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 8 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 344 KB Output is correct
2 Correct 12 ms 344 KB Output is correct
3 Correct 7 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
6 Correct 8 ms 596 KB Output is correct
7 Correct 8 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 344 KB Output is correct
2 Correct 9 ms 344 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 2 ms 344 KB Output is correct
5 Correct 7 ms 344 KB Output is correct
6 Correct 6 ms 344 KB Output is correct
7 Correct 7 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 12 ms 344 KB Output is correct
2 Correct 10 ms 344 KB Output is correct
3 Correct 5 ms 344 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 6 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 2 ms 596 KB Output is correct