Submission #918442

# Submission time Handle Problem Language Result Execution time Memory
918442 2024-01-29T20:35:11 Z ayankarimova Carnival (CEOI14_carnival) C++14
100 / 100
5 ms 1296 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const ll sz=200;
ll ans[sz];
map<vector<ll>, ll>mp;
ll query(vector<ll>c)
{
    if(mp[c]) return mp[c];
    cout<<c.size()<<endl;
    for(auto i:c){
        cout<<i<<' ';
    }
    cout<<endl;
    ll cur;
    cin>>cur;
    mp[c]=cur;
    return cur;
}
int main(){

    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    ll n;
    cin>>n;
    ll cur=0;
    vector<ll>v;
    for(int i=1; i<=n; i++){
        v.push_back(i);
        ll res=query(v);
        if(res>cur){
            cur=res;
            ans[i]=cur;
        }
        else{
            v.pop_back();
            ll l=0, r=v.size()-1;
            while(l<r){
                vector<ll>g;
                ll mid=(l+r)/2;
                for(int i=0; i<=mid; i++){
                    g.push_back(v[i]);
                }
                ll x=query(g);
                g.push_back(i);
                ll y=query(g);
                if(y>x){
                    l=mid+1;
                }
                else{
                    r=mid;
                }
            }
            ans[i]=ans[v[l]];
        }
    }
    cout<<0<<' ';
    for(int i=1; i<=n; i++){
        cout<<ans[i]<<' ';
    }
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 968 KB Output is correct
2 Correct 4 ms 708 KB Output is correct
3 Correct 3 ms 1224 KB Output is correct
4 Correct 3 ms 456 KB Output is correct
5 Correct 3 ms 456 KB Output is correct
6 Correct 1 ms 716 KB Output is correct
7 Correct 4 ms 712 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 1236 KB Output is correct
2 Correct 5 ms 984 KB Output is correct
3 Correct 3 ms 708 KB Output is correct
4 Correct 3 ms 708 KB Output is correct
5 Correct 3 ms 708 KB Output is correct
6 Correct 3 ms 712 KB Output is correct
7 Correct 4 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 456 KB Output is correct
2 Correct 3 ms 712 KB Output is correct
3 Correct 5 ms 972 KB Output is correct
4 Correct 2 ms 712 KB Output is correct
5 Correct 3 ms 716 KB Output is correct
6 Correct 4 ms 708 KB Output is correct
7 Correct 5 ms 968 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 712 KB Output is correct
2 Correct 4 ms 752 KB Output is correct
3 Correct 5 ms 456 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
5 Correct 4 ms 1220 KB Output is correct
6 Correct 3 ms 740 KB Output is correct
7 Correct 5 ms 1220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 712 KB Output is correct
2 Correct 5 ms 1224 KB Output is correct
3 Correct 5 ms 968 KB Output is correct
4 Correct 5 ms 1296 KB Output is correct
5 Correct 3 ms 712 KB Output is correct
6 Correct 3 ms 716 KB Output is correct
7 Correct 3 ms 728 KB Output is correct