# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
274109 | 2020-08-19T08:31:02 Z | toonewbie | Carnival (CEOI14_carnival) | C++17 | 11 ms | 384 KB |
#pragma GCC optimize("Ofast") #include <bits/stdc++.h> #define F first #define S second #define pb push_back //#define endl '\n' #define ll long long #define pi pair<int,int> using namespace std; const int MOD = 1e9 + 7; const int N = 155; int n, res[N]; int ask(vector<int> v) { cout << v.size() << " "; for (int i : v) cout << i << " "; cout << endl; int x; cin >> x; return x; } int main() { ios_base :: sync_with_stdio(0); cin.tie(0); cin >> n; vector<int> v = {1}; int say = 1; res[1] = 1; for (int i = 2; i <= n; i++) { v.pb(i); if (ask(v) == say + 1) { say++; res[i] = say; } else v.pop_back(); } for (int i = 1; i <= n; i++) { if (res[i] == 0) { int l = 0, r = (int)v.size() - 1, id; while(r - l >= 0) { int mid = (l + r) >> 1; vector<int> tmp = {i}; for (int i = 0; i <= mid; i++) tmp.pb(v[i]); /// mid + 1 if (ask(tmp) == mid + 1) { id = mid; r = mid - 1; } else l = mid + 1; } res[i] = res[v[id]]; } } cout << 0 << " "; for (int i = 1; i <= n; i++) { cout << res[i] << " "; } cout << endl; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 288 KB | Output is correct |
2 | Correct | 11 ms | 384 KB | Output is correct |
3 | Correct | 6 ms | 384 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 4 ms | 384 KB | Output is correct |
6 | Correct | 3 ms | 384 KB | Output is correct |
7 | Correct | 6 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Correct | 9 ms | 384 KB | Output is correct |
3 | Correct | 4 ms | 384 KB | Output is correct |
4 | Correct | 5 ms | 384 KB | Output is correct |
5 | Correct | 6 ms | 384 KB | Output is correct |
6 | Correct | 7 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 384 KB | Output is correct |
2 | Correct | 5 ms | 384 KB | Output is correct |
3 | Correct | 9 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 8 ms | 384 KB | Output is correct |
6 | Correct | 11 ms | 384 KB | Output is correct |
7 | Correct | 10 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 384 KB | Output is correct |
2 | Correct | 6 ms | 384 KB | Output is correct |
3 | Correct | 5 ms | 384 KB | Output is correct |
4 | Correct | 3 ms | 384 KB | Output is correct |
5 | Correct | 8 ms | 384 KB | Output is correct |
6 | Correct | 10 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 384 KB | Output is correct |
2 | Correct | 9 ms | 384 KB | Output is correct |
3 | Correct | 7 ms | 384 KB | Output is correct |
4 | Correct | 7 ms | 384 KB | Output is correct |
5 | Correct | 9 ms | 384 KB | Output is correct |
6 | Correct | 7 ms | 384 KB | Output is correct |
7 | Correct | 5 ms | 384 KB | Output is correct |