# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
83198 | 2018-11-06T00:47:37 Z | RezwanArefin01 | Carnival (CEOI14_carnival) | C++17 | 10 ms | 644 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> ii; int n, a[200]; int ask(vector<int> v) { cout << v.size(); for(int x : v) cout << " " << x; cout << endl; int x; cin >> x; return x; } int main() { cin >> n; vector<int> u = {1}; for(int i = 2; i <= n; i++) { vector<int> v = u; v.push_back(i); if(ask(v) == v.size()) u = v; } for(int i = 0; i < u.size(); i++) a[u[i]] = i + 1; for(int i = 1; i <= n; i++) if(!a[i]) { int lo = 0, hi = (int)u.size() - 1, idx; while(lo <= hi) { int mid = lo + hi >> 1; vector<int> v = {i}; for(int j = 0; j < mid; j++) v.push_back(u[j]); if(ask(v) == v.size()) idx = mid, lo = mid + 1; else hi = mid - 1; } a[i] = a[u[idx]]; } cout << 0; for(int i = 1; i <= n; i++) cout << " " << a[i]; cout << endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 504 KB | Output is correct |
2 | Correct | 9 ms | 504 KB | Output is correct |
3 | Correct | 10 ms | 504 KB | Output is correct |
4 | Correct | 4 ms | 504 KB | Output is correct |
5 | Correct | 3 ms | 504 KB | Output is correct |
6 | Correct | 5 ms | 504 KB | Output is correct |
7 | Correct | 9 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 528 KB | Output is correct |
2 | Correct | 10 ms | 528 KB | Output is correct |
3 | Correct | 8 ms | 528 KB | Output is correct |
4 | Correct | 7 ms | 644 KB | Output is correct |
5 | Correct | 9 ms | 644 KB | Output is correct |
6 | Correct | 7 ms | 644 KB | Output is correct |
7 | Correct | 8 ms | 644 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 644 KB | Output is correct |
2 | Correct | 8 ms | 644 KB | Output is correct |
3 | Correct | 10 ms | 644 KB | Output is correct |
4 | Correct | 5 ms | 644 KB | Output is correct |
5 | Correct | 7 ms | 644 KB | Output is correct |
6 | Correct | 9 ms | 644 KB | Output is correct |
7 | Correct | 6 ms | 644 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 644 KB | Output is correct |
2 | Correct | 4 ms | 644 KB | Output is correct |
3 | Correct | 5 ms | 644 KB | Output is correct |
4 | Correct | 5 ms | 644 KB | Output is correct |
5 | Correct | 8 ms | 644 KB | Output is correct |
6 | Correct | 5 ms | 644 KB | Output is correct |
7 | Correct | 9 ms | 644 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 644 KB | Output is correct |
2 | Correct | 9 ms | 644 KB | Output is correct |
3 | Correct | 6 ms | 644 KB | Output is correct |
4 | Correct | 7 ms | 644 KB | Output is correct |
5 | Correct | 6 ms | 644 KB | Output is correct |
6 | Correct | 8 ms | 644 KB | Output is correct |
7 | Correct | 5 ms | 644 KB | Output is correct |