Submission #71657

# Submission time Handle Problem Language Result Execution time Memory
71657 2018-08-25T10:11:03 Z someone_aa Carnival (CEOI14_carnival) C++17
100 / 100
15 ms 580 KB
#include <bits/stdc++.h>
using namespace std;
const int maxn = 200;
int qinit[maxn], ind[maxn];
int arr[maxn], n, br;

int query(int li, int ri, int i) {
    int answ;
    cout<<(ri-li+2)<<" ";
    for(int i=li;i<=ri;i++) {
        cout<<ind[i]<<" ";
    } cout<<i<<"\n";
    fflush(stdout);
    cin>>answ;
    return answ;
}

int bin_search(int i, int l, int r) {
    int mid = (l+r)/2;
    if(l==r) return l;
    else {
        if(query(l, mid, i) == (mid-l+1)) return bin_search(i, l, mid);
        else return bin_search(i, mid+1,r);
    }
}

void init() {
    int answ;
    for(int i=1;i<=n;i++) {
        cout<<i<<" ";
        for(int j=1;j<=i;j++) {
            cout<<j<<" ";
        } cout<<"\n";
        fflush(stdout);
        cin>>answ;
        qinit[i] = answ;
    }

    br = 1;
    for(int i=1;i<=n;i++) {
        if(qinit[i] > qinit[i-1]) {
            ind[br] = i;
            arr[i] = br++;
        }
    }
    br--;

    for(int i=1;i<=n;i++) {
        if(arr[i] == 0) {
            arr[i] = bin_search(i, 1, br);
        }
    }

    cout<<"0 ";
    for(int i=1;i<=n;i++) {
        cout<<arr[i]<<" ";
    } cout<<"\n";
    fflush(stdout);
}

int main() {
    cin>>n;
    init();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 10 ms 376 KB Output is correct
2 Correct 9 ms 440 KB Output is correct
3 Correct 5 ms 440 KB Output is correct
4 Correct 6 ms 580 KB Output is correct
5 Correct 7 ms 580 KB Output is correct
6 Correct 6 ms 580 KB Output is correct
7 Correct 10 ms 580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 8 ms 580 KB Output is correct
2 Correct 11 ms 580 KB Output is correct
3 Correct 8 ms 580 KB Output is correct
4 Correct 7 ms 580 KB Output is correct
5 Correct 8 ms 580 KB Output is correct
6 Correct 10 ms 580 KB Output is correct
7 Correct 10 ms 580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 580 KB Output is correct
2 Correct 9 ms 580 KB Output is correct
3 Correct 13 ms 580 KB Output is correct
4 Correct 8 ms 580 KB Output is correct
5 Correct 15 ms 580 KB Output is correct
6 Correct 9 ms 580 KB Output is correct
7 Correct 10 ms 580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 580 KB Output is correct
2 Correct 6 ms 580 KB Output is correct
3 Correct 6 ms 580 KB Output is correct
4 Correct 4 ms 580 KB Output is correct
5 Correct 9 ms 580 KB Output is correct
6 Correct 8 ms 580 KB Output is correct
7 Correct 9 ms 580 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 580 KB Output is correct
2 Correct 8 ms 580 KB Output is correct
3 Correct 7 ms 580 KB Output is correct
4 Correct 9 ms 580 KB Output is correct
5 Correct 7 ms 580 KB Output is correct
6 Correct 5 ms 580 KB Output is correct
7 Correct 5 ms 580 KB Output is correct