# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
385681 | 2021-04-04T17:37:16 Z | monus1042 | Carnival (CEOI14_carnival) | C++17 | 14 ms | 528 KB |
#include <bits/stdc++.h> using namespace std; typedef pair<int,int> ii; #define pb push_back const int NAX = 200; int n; int main(){ cin>>n; map<int, vector<int> > g; int curr=1; g[1].pb(1); for (int i=2; i<=n; i++){ cout<<i<<' '; for (auto j=g.begin(); j!=g.end(); j++){ for (int k=0; k<j->second.size(); k++){ cout<<j->second[k]<<' '; } } cout<<i; cout<<endl; int ans; cin>>ans; if (ans>curr){ curr++; g[curr].pb(i); }else{ // it's equal vector<ii> aux; // index, color for (auto j=g.begin(); j!=g.end(); j++) aux.pb(ii(j->second[0], j->first)); int m=aux.size(); int lo=m-1, hi=-1; while(lo-1!=hi){ int mid=(lo+hi)/2; vector<int> show; for (int k=mid; k<m; k++){ show.pb(aux[k].first); } cout<<show.size() + 1<<' '; for (int k=0; k<show.size(); k++) cout<<show[k]<<' '; cout<<i; cout<<endl; int an; cin>>an; if (an==(int)show.size() + 1) lo=mid; else hi=mid; } int mid=lo; vector<int> show; for (int k=mid; k<m; k++){ show.pb(aux[k].first); } cout<<show.size() + 1<<' '; for (int k=0; k<show.size(); k++) cout<<show[k]<<' '; cout<<i; cout<<endl; int an; cin>>an; if (an==(int)show.size() + 1) lo--; g[aux[lo].second].pb(i); } } vector<int> ans(NAX); for (auto i=g.begin(); i!=g.end(); i++){ for (int j=0; j<i->second.size(); j++) ans[i->second[j]]=i->first; } cout<<0<<' '; for (int i=1; i<=n; i++) cout<<ans[i]<<' '; cout<<endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 364 KB | Output is correct |
2 | Correct | 10 ms | 364 KB | Output is correct |
3 | Correct | 7 ms | 364 KB | Output is correct |
4 | Correct | 6 ms | 364 KB | Output is correct |
5 | Correct | 9 ms | 364 KB | Output is correct |
6 | Correct | 6 ms | 492 KB | Output is correct |
7 | Correct | 11 ms | 492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 364 KB | Output is correct |
2 | Correct | 11 ms | 364 KB | Output is correct |
3 | Correct | 6 ms | 364 KB | Output is correct |
4 | Correct | 6 ms | 364 KB | Output is correct |
5 | Correct | 7 ms | 376 KB | Output is correct |
6 | Correct | 11 ms | 364 KB | Output is correct |
7 | Correct | 8 ms | 492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 364 KB | Output is correct |
2 | Correct | 11 ms | 364 KB | Output is correct |
3 | Correct | 13 ms | 364 KB | Output is correct |
4 | Correct | 5 ms | 364 KB | Output is correct |
5 | Correct | 12 ms | 364 KB | Output is correct |
6 | Correct | 10 ms | 380 KB | Output is correct |
7 | Correct | 14 ms | 492 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 364 KB | Output is correct |
2 | Correct | 9 ms | 364 KB | Output is correct |
3 | Correct | 5 ms | 376 KB | Output is correct |
4 | Correct | 4 ms | 528 KB | Output is correct |
5 | Correct | 8 ms | 364 KB | Output is correct |
6 | Correct | 9 ms | 364 KB | Output is correct |
7 | Correct | 11 ms | 364 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 492 KB | Output is correct |
2 | Correct | 13 ms | 384 KB | Output is correct |
3 | Correct | 12 ms | 364 KB | Output is correct |
4 | Correct | 9 ms | 364 KB | Output is correct |
5 | Correct | 9 ms | 364 KB | Output is correct |
6 | Correct | 9 ms | 364 KB | Output is correct |
7 | Correct | 6 ms | 364 KB | Output is correct |