Submission #918559

# Submission time Handle Problem Language Result Execution time Memory
918559 2024-01-30T06:42:39 Z vjudge1 Carnival (CEOI14_carnival) C++17
100 / 100
8 ms 1460 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define fir first 
#define sec second 

int main(){
    int n;
    vector<ll>v;
    cin >> n;
    vector<ll>ans(n+1);
    map<vector<ll>, ll>m;
    ll max_ = 0;
    for(int i = 1; i <=n; i++) {
        v.pb(i);  
        int val = 0;
        if(!m[v]){
            cout << v.size() << " ";
            for(int i : v) cout << i << " ";
            cout << endl;
            cin >> val;
            m[v]=val;
        }
        else{
            val = m[v];
        }
        if(val<=max_){
            v.pop_back();
            ll a=0;
            ll l = 0, r = v.size()-1;
            while(l < r){
                
                ll mid = (l+r)/2;
                cout << mid +1 << " ";
                for(int j = 0; j <=mid; j++){
                    cout << v[j] << " ";
                }
                cout << endl;
                cin >> a;
                cout << mid + 2 << " ";
                for(int j= 0; j<=mid; j++){
                    cout << v[j] << " ";
                }
                cout <<i << endl;
                
                ll b =0;
                cin >>b;
                if(a>=b) r= mid;
                else l = mid+1;
            }
            ans[i] = ans[v[l]];
        }
        else{
            max_ = val;
            ans[i]=max_;
        }
    }
    cout << 0 << " ";
    for(int i = 1; i <=n; i++){
        cout << ans[i] << " ";
    }
    cout << endl;
    
    
    
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 948 KB Output is correct
2 Correct 6 ms 1228 KB Output is correct
3 Correct 4 ms 688 KB Output is correct
4 Correct 3 ms 948 KB Output is correct
5 Correct 2 ms 432 KB Output is correct
6 Correct 2 ms 696 KB Output is correct
7 Correct 6 ms 1128 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 944 KB Output is correct
2 Correct 6 ms 688 KB Output is correct
3 Correct 3 ms 692 KB Output is correct
4 Correct 3 ms 1460 KB Output is correct
5 Correct 5 ms 948 KB Output is correct
6 Correct 4 ms 1200 KB Output is correct
7 Correct 6 ms 1372 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 436 KB Output is correct
2 Correct 4 ms 948 KB Output is correct
3 Correct 8 ms 1216 KB Output is correct
4 Correct 2 ms 688 KB Output is correct
5 Correct 4 ms 708 KB Output is correct
6 Correct 5 ms 688 KB Output is correct
7 Correct 6 ms 1200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 692 KB Output is correct
2 Correct 4 ms 692 KB Output is correct
3 Correct 4 ms 1204 KB Output is correct
4 Correct 2 ms 948 KB Output is correct
5 Correct 8 ms 1208 KB Output is correct
6 Correct 5 ms 692 KB Output is correct
7 Correct 6 ms 944 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 432 KB Output is correct
2 Correct 6 ms 948 KB Output is correct
3 Correct 5 ms 948 KB Output is correct
4 Correct 6 ms 848 KB Output is correct
5 Correct 5 ms 700 KB Output is correct
6 Correct 3 ms 496 KB Output is correct
7 Correct 3 ms 696 KB Output is correct