Submission #607479

#TimeUsernameProblemLanguageResultExecution timeMemory
607479hailCarnival (CEOI14_carnival)C++17
100 / 100
26 ms284 KiB
#include <bits/stdc++.h> using namespace std; vector<int> final(0); int c; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin>>n; final.resize(n+1); fill(final.begin(), final.end(), 0); final[1]=1; c = 1; int high; int low; int mid; int num_types; int verify_types; for(int i = 2; i<=n; i++) { cout<<i<<" "; for(int j=1; j<=i; j++) { cout<<j<<" "; } cout<<endl; cin>>num_types; if(num_types!=c) { final[i] = c+1; c++; } else { low = 1; high = i-1; while(high-low>1) { mid = (high + low)/2; cout<<mid<<" "; for(int j=1; j<=mid; j++) { cout<<j<<" "; } cout<<endl; cin>>num_types; cout<<mid+1<<" "; for(int j=1; j<=mid; j++) { cout<<j<<" "; } cout<<i<<endl; cin>>verify_types; if(verify_types==num_types) high = mid; else low = mid; } cout<<2<<" "<<low<<" "<<i<<endl; cin>>num_types; if(num_types==1) final[i] = final[low]; else final[i] = final[high]; } } cout<<0<<" "; for(int i=1; i<=n; i++) { cout<<final[i]<<" "; } cout<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...