# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
681081 | 2023-01-12T10:41:31 Z | Alexandruabcde | Carnival (CEOI14_carnival) | C++14 | 15 ms | 288 KB |
#include <bits/stdc++.h> using namespace std; constexpr int NMAX = 155; vector <int> AllDifferent; bool Question (int ind, int x) { cout << ind + 2 << " "; for (int i = 0; i <= ind; ++ i ) cout << AllDifferent[i] << " "; cout << x << '\n'; cout.flush(); int ans; cin >> ans; return (ans == ind + 2); } int color[NMAX]; int N; void BinarySearch (int x) { int st = 0, dr = AllDifferent.size() - 1; int pos = AllDifferent.size(); while (st <= dr) { int mij = (st + dr) / 2; if (Question(mij, x)) st = mij + 1; else { dr = mij - 1; pos = mij; } } color[x] = pos+1; if (pos == AllDifferent.size()) AllDifferent.push_back(x); } int main () { cin >> N; AllDifferent.push_back(1); color[1] = 1; for (int i = 2; i <= N; ++ i ) { BinarySearch(i); } cout << 0 << " "; for (int i = 1; i <= N; ++ i ) cout << color[i] << " "; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 208 KB | Output is correct |
2 | Correct | 6 ms | 208 KB | Output is correct |
3 | Correct | 9 ms | 208 KB | Output is correct |
4 | Correct | 12 ms | 276 KB | Output is correct |
5 | Correct | 2 ms | 208 KB | Output is correct |
6 | Correct | 2 ms | 208 KB | Output is correct |
7 | Correct | 6 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 208 KB | Output is correct |
2 | Correct | 10 ms | 208 KB | Output is correct |
3 | Correct | 5 ms | 208 KB | Output is correct |
4 | Correct | 12 ms | 208 KB | Output is correct |
5 | Correct | 4 ms | 208 KB | Output is correct |
6 | Correct | 4 ms | 208 KB | Output is correct |
7 | Correct | 5 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 208 KB | Output is correct |
2 | Correct | 4 ms | 208 KB | Output is correct |
3 | Correct | 10 ms | 208 KB | Output is correct |
4 | Correct | 12 ms | 288 KB | Output is correct |
5 | Correct | 6 ms | 208 KB | Output is correct |
6 | Correct | 6 ms | 208 KB | Output is correct |
7 | Correct | 7 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 208 KB | Output is correct |
2 | Correct | 4 ms | 208 KB | Output is correct |
3 | Correct | 8 ms | 208 KB | Output is correct |
4 | Correct | 15 ms | 276 KB | Output is correct |
5 | Correct | 6 ms | 208 KB | Output is correct |
6 | Correct | 9 ms | 208 KB | Output is correct |
7 | Correct | 6 ms | 208 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 288 KB | Output is correct |
2 | Correct | 5 ms | 248 KB | Output is correct |
3 | Correct | 14 ms | 208 KB | Output is correct |
4 | Correct | 10 ms | 208 KB | Output is correct |
5 | Correct | 10 ms | 208 KB | Output is correct |
6 | Correct | 12 ms | 208 KB | Output is correct |
7 | Correct | 13 ms | 288 KB | Output is correct |