Submission #238918

# Submission time Handle Problem Language Result Execution time Memory
238918 2020-06-13T13:25:00 Z Autoratch Carnival (CEOI14_carnival) C++14
100 / 100
37 ms 384 KB
#include <bits/stdc++.h>
using namespace std;

const int N = 151;

int n,lst,cur,ans[N];

int ask(int l,int r,int x)
{
    cout << r-l+2 << ' ';
    for(int i = l;i <= r;i++) cout << i << ' ';
    cout << x << endl;
    int ret;
    cin >> ret;
    return ret;
}

void solve(int l,int r,int x)
{
    if(l==r) return void(ans[x] = ans[l]);
    int m = (l+r)/2;
    if(ask(l,m-1,m)==ask(l,m,x)) solve(l,m,x);
    else solve(m+1,r,x);
}

int main()
{
    cin >> n;
    for(int i = 1;i <= n;i++) 
    {
        if(ask(1,i-1,i)!=lst) ans[i] = ++cur;
        else solve(1,i-1,i);
        lst = ask(1,i-1,i);
    }
    cout << "0 ";
    for(int i = 1;i <= n;i++) cout << ans[i] << ' ';
    cout << endl;
}
# Verdict Execution time Memory Grader output
1 Correct 16 ms 256 KB Output is correct
2 Correct 26 ms 256 KB Output is correct
3 Correct 16 ms 384 KB Output is correct
4 Correct 8 ms 256 KB Output is correct
5 Correct 31 ms 384 KB Output is correct
6 Correct 33 ms 384 KB Output is correct
7 Correct 21 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 384 KB Output is correct
2 Correct 24 ms 256 KB Output is correct
3 Correct 14 ms 256 KB Output is correct
4 Correct 10 ms 256 KB Output is correct
5 Correct 26 ms 256 KB Output is correct
6 Correct 32 ms 384 KB Output is correct
7 Correct 26 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 256 KB Output is correct
2 Correct 31 ms 256 KB Output is correct
3 Correct 25 ms 384 KB Output is correct
4 Correct 11 ms 256 KB Output is correct
5 Correct 29 ms 256 KB Output is correct
6 Correct 28 ms 384 KB Output is correct
7 Correct 22 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 32 ms 256 KB Output is correct
2 Correct 34 ms 256 KB Output is correct
3 Correct 15 ms 256 KB Output is correct
4 Correct 10 ms 256 KB Output is correct
5 Correct 22 ms 256 KB Output is correct
6 Correct 22 ms 256 KB Output is correct
7 Correct 23 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 256 KB Output is correct
2 Correct 32 ms 256 KB Output is correct
3 Correct 21 ms 256 KB Output is correct
4 Correct 11 ms 256 KB Output is correct
5 Correct 19 ms 384 KB Output is correct
6 Correct 16 ms 256 KB Output is correct
7 Correct 13 ms 384 KB Output is correct