Submission #702846

#TimeUsernameProblemLanguageResultExecution timeMemory
702846yhkhooCarnival (CEOI14_carnival)C++17
100 / 100
11 ms444 KiB
#include <bits/stdc++.h> using namespace std; int main(){ ios_base::sync_with_stdio(0); int n; cin >> n; int a[n+1]; int coscount = 0, prev=0; map<int, vector<int>> people; for(int i=1; i<=n; i++){ cout << i << ' '; for(int j=1; j<=i; j++){ cout << j << ' '; } cout << endl; int nc; cin >> nc; if(nc != prev){ // costume worn by i is new coscount++; prev = nc; a[i] = coscount; } else{ // costume is not new int s=1, e=coscount; while(s!=e){ int m=(s+e)/2; vector<int> party; for(int j=s; j<=m; j++){ for(auto k=people[j].begin(); k!=people[j].end(); k++){ party.push_back(*k); } } cout << party.size()+1 << ' '; for(auto j=party.begin(); j!=party.end(); j++){ cout << *j << ' '; } cout << i << ' '; cout << endl; int np; cin >> np; if(np == m-s+1){ //in range e=m; } else{ s=m+1; } } a[i] = s; } people[a[i]].push_back(i); } cout << "0 "; for(int i=1; i<=n; i++){ cout << a[i] << ' '; } 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...