Submission #918063

# Submission time Handle Problem Language Result Execution time Memory
918063 2024-01-29T13:01:56 Z vjudge1 Carnival (CEOI14_carnival) C++17
100 / 100
18 ms 6996 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
#define MAX 200001
#define INF INT_MAX
//#define ll int
#define MOD 1000000007
#define mp make_pair
#define mt make_tuple
#define pb push_back
#define ins insert
#define ff first
#define ss second 
#define gett(x,m) get<m>(x)
#define all(a) a.begin(),a.end()
#define lb(a,b) lower_bound(all(a),b)
#define ub(a,b) upper_bound(all(a),b)
#define sortv(a) sort(all(a))
#define sorta(a,sz) sort(a,a+sz)
#define inputar(a,b){\
    for(int i=0;i<b;i++){\
        cin >> a[i];\
    }\
}
#define inputvec(a,b){\
    for(int i=0;i<b;i++){\
        ll num;\
        cin >> num;\
        a.pb(num);\
    }\
}
#define outputar(a,b){\
    for(int i=0;i<b;i++){\
        cout << a[i] << " ";\
    }\
    cout << "\n";\
}
#define outputvec(a){\
    for(auto x:a){\
        cout << (int)x << " ";\
    }\
    cout << "\n";\
}
#define reset(a,n,v){\
    for(int i=0;i<n;i++){\
        a[i]=v;\
    }\
}
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
typedef tuple<ll,ll,ll> tll;
typedef pair<ll,ll> pll;
typedef pair<int,int> pii;
typedef double db;
typedef long double ldb;
inline void USACO(string filename){
  freopen((filename+".in").c_str(),"r",stdin);
  freopen((filename+".out").c_str(),"w",stdout);
}
int n,m,a[MAX],t=1;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
string s[MAX],str[1];
string s1,s2;
const int mod = 998244353;
ll dx[4]={1,0,0,-1};
ll dy[4]={0,1,-1,0};
bool f(ll x,ll y){
    ll h,h1;
    cout << x << " ";
    for(int i=1;i<=x;i++){
        cout << i << " ";
    }
    cout << endl; 
    cin >> h; 
    cout << x+1 << " "; 
    for(int i=1;i<=x;i++){
        cout << i << " ";
    }
    cout << y << " ";
    cout << endl; 
    cin >> h1;
    return (h==h1);
}
void solve(){
    cin >> n; 
    a[1]=1; 
    ll cnt=2;
    for(int i=2;i<=n;i++){
        ll l=1,r=i-1; 
        while(l<r){
            ll mid=(l+r)/2; 
            if(f(mid,i)){
                r=mid; 
            }
            else{
                l=mid+1;
            }
        }
        if(f(l,i)){
            a[i]=a[l];
        }
        else{
            a[i]=cnt;
            cnt++;
        }
    }
    cout << 0 << " ";
    for(int i=1;i<=n;i++){
        cout << a[i] << " ";
    }
    cout << endl;
} 
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    //USACO("diamond");
    //freopen("meta_game_input.txt","r",stdin);
    //freopen("output.txt","w",stdout);
    //cin >> t;
    ll cnt1=1;
    while(t--){
        //cout << "Case #" << cnt1 << ": ";
        solve();
        cnt1++;
    }
}
/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
ifstream fin("template.in");
ofstream fout("template.out");
*/
/*
freopen("input.txt","r",stdin);
freopen("output.txt","w",stdout);
ifstream fin("template.in");
ofstream fout("template.out");
*/
/*
ll b[51][51];
b[0][0] = 1;
    for (int n = 1; n <= 50; ++n){
        b[n][0] = b[n][n] = 1;
        for (int k = 1; k < n; ++k)
            b[n][k] = b[n - 1][k - 1] + b[n - 1][k];
    }
*/
# Verdict Execution time Memory Grader output
1 Correct 9 ms 6744 KB Output is correct
2 Correct 13 ms 6744 KB Output is correct
3 Correct 16 ms 6744 KB Output is correct
4 Correct 13 ms 6744 KB Output is correct
5 Correct 10 ms 6744 KB Output is correct
6 Correct 11 ms 6744 KB Output is correct
7 Correct 11 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 6744 KB Output is correct
2 Correct 13 ms 6744 KB Output is correct
3 Correct 12 ms 6744 KB Output is correct
4 Correct 17 ms 6744 KB Output is correct
5 Correct 10 ms 6744 KB Output is correct
6 Correct 13 ms 6744 KB Output is correct
7 Correct 12 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 14 ms 6744 KB Output is correct
2 Correct 11 ms 6744 KB Output is correct
3 Correct 15 ms 6744 KB Output is correct
4 Correct 17 ms 6996 KB Output is correct
5 Correct 15 ms 6744 KB Output is correct
6 Correct 12 ms 6744 KB Output is correct
7 Correct 12 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 6744 KB Output is correct
2 Correct 14 ms 6992 KB Output is correct
3 Correct 16 ms 6744 KB Output is correct
4 Correct 18 ms 6744 KB Output is correct
5 Correct 12 ms 6744 KB Output is correct
6 Correct 13 ms 6744 KB Output is correct
7 Correct 14 ms 6744 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 10 ms 6744 KB Output is correct
2 Correct 14 ms 6744 KB Output is correct
3 Correct 13 ms 6744 KB Output is correct
4 Correct 15 ms 6744 KB Output is correct
5 Correct 13 ms 6744 KB Output is correct
6 Correct 15 ms 6744 KB Output is correct
7 Correct 16 ms 6744 KB Output is correct