# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
166679 | 2019-12-03T13:02:47 Z | alanhpereira | Carnival (CEOI14_carnival) | C++11 | 19 ms | 448 KB |
#include <bits/stdc++.h> #define MAX 160 using namespace std; vector<int> lists[MAX]; int nlidx = 0; int group[MAX]; int query(int l, int r, int e) { printf("%d ", r - l + 2); for (int i = l; i <= r; i++) { printf("%d ", lists[i][0]); } printf("%d\n", e); fflush(stdout); int ans; scanf("%d", &ans); return ans; } int main() { int n; scanf("%d", &n); group[1] = 1; lists[nlidx++].push_back(1); for (int i = 2; i <= n; i++) { int l = 0, r = nlidx - 1; int ans = query(l, r, i); if (ans == nlidx + 1) { lists[nlidx++].push_back(i); group[i] = nlidx; continue; } while (l != r) { int mid = (l + r) / 2; ans = query(l, mid, i); if (ans == mid - l + 2) { l = mid + 1; } else { r = mid; } } lists[l].push_back(i); group[i] = l + 1; } printf("0 "); for (int i = 1; i <= n; i++) { printf("%d ", group[i]); } printf("\n"); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 9 ms | 376 KB | Output is correct |
2 | Correct | 10 ms | 248 KB | Output is correct |
3 | Correct | 5 ms | 448 KB | Output is correct |
4 | Correct | 4 ms | 384 KB | Output is correct |
5 | Correct | 5 ms | 248 KB | Output is correct |
6 | Correct | 3 ms | 324 KB | Output is correct |
7 | Correct | 8 ms | 380 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
2 | Correct | 6 ms | 316 KB | Output is correct |
3 | Correct | 4 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 5 ms | 316 KB | Output is correct |
6 | Correct | 7 ms | 248 KB | Output is correct |
7 | Correct | 5 ms | 324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 320 KB | Output is correct |
2 | Correct | 9 ms | 380 KB | Output is correct |
3 | Correct | 10 ms | 376 KB | Output is correct |
4 | Correct | 4 ms | 400 KB | Output is correct |
5 | Correct | 5 ms | 248 KB | Output is correct |
6 | Correct | 8 ms | 376 KB | Output is correct |
7 | Correct | 10 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 248 KB | Output is correct |
2 | Correct | 8 ms | 376 KB | Output is correct |
3 | Correct | 7 ms | 376 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 9 ms | 376 KB | Output is correct |
6 | Correct | 9 ms | 376 KB | Output is correct |
7 | Correct | 10 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 408 KB | Output is correct |
3 | Correct | 19 ms | 376 KB | Output is correct |
4 | Correct | 11 ms | 376 KB | Output is correct |
5 | Correct | 10 ms | 248 KB | Output is correct |
6 | Correct | 7 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 400 KB | Output is correct |