# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
113666 | 2019-05-27T15:36:55 Z | Adhyyan1252 | Carnival (CEOI14_carnival) | C++11 | 6 ms | 384 KB |
#include<bits/stdc++.h> using namespace std; int query(const vector<int>& a){ if(a.size() == 0) return 0; cout<<a.size()<<endl; for(int b: a) cout<<b+1<<" "; cout<<endl; int ret; cin>>ret; return ret; } int main(){ int n; cin>>n; vector<int> a(n, -1); a[0] = 1; int pntr = 2; vector<int> diff; diff.push_back(0); for(int i = 1; i < n; i++){ int low = 0, high = diff.size()-1, mid; vector<int> c(diff); c.push_back(i); if(query(c) == c.size()){ //this is a new one a[i]= pntr; pntr++; diff.push_back(i); continue; } while(low < high){ mid = (low + high)/2; vector<int> b(diff.begin() + low, diff.begin() + mid + 1); b.push_back(i); int q = query(b); if(q == b.size()-1){ //means that they share the shit high = mid; }else{ low = mid+1; } } mid = (low + high)/2; a[i] = a[mid]; } cout<<0<<" "; for(int i = 0; i < n; i++) cout<<a[i]<<" "; cout<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 256 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 384 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Incorrect | 4 ms | 384 KB | Incorrect |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 252 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Incorrect | 6 ms | 256 KB | Incorrect |
3 | Halted | 0 ms | 0 KB | - |