# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
131842 | 2019-07-17T19:42:03 Z | shafinalam | Carnival (CEOI14_carnival) | C++14 | 9 ms | 376 KB |
#include <bits/stdc++.h> using namespace std; int ans[1000]; int query(vector<int>v) { int sz = v.size(); cout << sz; for(int i : v) cout << ' ' << i; cout << endl; int x; cin >> x; return x; } int main() { int n; cin >> n; vector<int>arr; arr.push_back(1); for(int i = 2; i <= n; i++) { vector<int>tmp = arr; tmp.push_back(i); if(query(tmp)==tmp.size()) arr = tmp; } for(int i = 0; i < arr.size(); i++) ans[arr[i]] = i+1; for(int i = 1; i <= n; i++) { if(ans[i]) continue; int lo = 0, hi = arr.size()-1, indx; while(lo<=hi) { int mid = (lo+hi)>>1; vector<int>tmp; tmp.push_back(i); for(int r = 0; r < mid; r++) tmp.push_back(arr[r]); if(query(tmp)==mid) { indx = mid-1; hi = mid-1; } else lo = mid+1; } ans[i] = arr[indx]; } 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 | Incorrect | 9 ms | 248 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 248 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Incorrect | 6 ms | 376 KB | Integer 11 violates the range [1, 8] |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 248 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 4 ms | 312 KB | Incorrect |
2 | Halted | 0 ms | 0 KB | - |