# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
52197 | 2018-06-24T18:07:40 Z | zadrga | Carnival (CEOI14_carnival) | C++14 | 10 ms | 580 KB |
#include <bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define INF (1LL << 55) #define maxn 155 typedef long long ll; typedef pair<int, int> pii; int val[maxn]; vector<int> v; int ask(int l, int d, int x){ vector<int> cur; for(int i = l; i <= d; i++) cur.pb(v[i]); cur.pb(x); cout << cur.size(); for(int i : cur) cout << " " << i; cout << endl; int ret; cin >> ret; return ret; } int main(){ int n, cnt = 0; scanf("%d", &n); for(int i = 1; i <= n; i++){ int num = ask(0, v.size() - 1, i); if(num == v.size() + 1){ v.pb(i); val[i] = ++cnt; continue; } int l = 0, d = v.size() - 1, mid; while(l <= d){ mid = (l + d) / 2; num = ask(l, mid, i); if(num == 1){ val[i] = val[v[l]]; break; } if(num == (mid - l + 1 + 1)) l = mid + 1; else d = mid; } } cout << "0"; for(int i = 1; i <= n; i++) cout << " " << val[i]; cout << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 248 KB | Output is correct |
2 | Correct | 8 ms | 308 KB | Output is correct |
3 | Correct | 7 ms | 392 KB | Output is correct |
4 | Correct | 4 ms | 396 KB | Output is correct |
5 | Correct | 5 ms | 396 KB | Output is correct |
6 | Correct | 4 ms | 416 KB | Output is correct |
7 | Correct | 7 ms | 416 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 416 KB | Output is correct |
2 | Correct | 7 ms | 416 KB | Output is correct |
3 | Correct | 6 ms | 492 KB | Output is correct |
4 | Correct | 6 ms | 492 KB | Output is correct |
5 | Correct | 6 ms | 492 KB | Output is correct |
6 | Correct | 7 ms | 524 KB | Output is correct |
7 | Correct | 7 ms | 580 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 580 KB | Output is correct |
2 | Correct | 6 ms | 580 KB | Output is correct |
3 | Correct | 5 ms | 580 KB | Output is correct |
4 | Correct | 5 ms | 580 KB | Output is correct |
5 | Correct | 7 ms | 580 KB | Output is correct |
6 | Correct | 7 ms | 580 KB | Output is correct |
7 | Correct | 7 ms | 580 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 580 KB | Output is correct |
2 | Correct | 9 ms | 580 KB | Output is correct |
3 | Correct | 6 ms | 580 KB | Output is correct |
4 | Correct | 7 ms | 580 KB | Output is correct |
5 | Correct | 7 ms | 580 KB | Output is correct |
6 | Correct | 7 ms | 580 KB | Output is correct |
7 | Correct | 10 ms | 580 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 580 KB | Output is correct |
2 | Correct | 6 ms | 580 KB | Output is correct |
3 | Correct | 7 ms | 580 KB | Output is correct |
4 | Correct | 7 ms | 580 KB | Output is correct |
5 | Correct | 5 ms | 580 KB | Output is correct |
6 | Correct | 4 ms | 580 KB | Output is correct |
7 | Correct | 4 ms | 580 KB | Output is correct |