# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
203562 | 2020-02-21T09:14:57 Z | triplem5ds | Carnival (CEOI14_carnival) | C++14 | 19 ms | 376 KB |
#pragma GCC optimize ("O3") #pragma GCC optimize ("unroll-loops") #include "bits/stdc++.h" using namespace std; #define f(i,a,b) for(int i = a; i < b; i++) #define pb push_back #define F first #define S second const int N = 1e6+5; const int MOD = 1e9 + 7; int ask(vector<int> v){ cout<<v.size(); for(auto x:v)cout<<' '<<x; cout<<endl; int ret; cin >> ret; return ret; } vector<int> v; vector<int> notVisited; void solve(int s, int e){ if(s>e)return; int md = (s+e)>>1; f(i,s,e+1)v.pb(notVisited[i]); int x = ask(v); if(x!=1) f(i,s,e+1)v.pop_back(); if(s==e)return; solve(s,md); solve(md+1,e); } int32_t main(){ #ifdef ONLINE_JUDGE ios_base::sync_with_stdio(0); cin.tie(0); #endif // ONLINE_JUDGE int n; cin >> n; vector<bool>vis(n+1); map<int,int> mp; int cur = 0; while(mp.size()!=n){ v.clear(); notVisited.clear(); f(i,1,n+1)if(!vis[i])notVisited.pb(i); v.pb(notVisited[0]); vis[notVisited[0]] = 1; notVisited.erase(notVisited.begin()); solve(0,(int)notVisited.size()-1); cur++; for(auto k:v){ vis[k]=1; mp[k]=cur; } } cout<<0; f(i,1,n+1) cout << ' ' << mp[i]; cout << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 19 ms | 376 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 12 ms | 376 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 248 KB | Integer 199 violates the range [0, 133] |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 376 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 10 ms | 376 KB | Same person came twice to the party. |
2 | Halted | 0 ms | 0 KB | - |