# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
451307 | 2021-08-03T07:14:27 Z | kingfran1907 | 사육제 (CEOI14_carnival) | C++14 | 20 ms | 312 KB |
#include <bits/stdc++.h> #define X first #define Y second using namespace std; typedef long long llint; const int maxn = 2e5+10; const int base = 31337; const int mod = 1e9+7; const int inf = 0x3f3f3f3f; const int logo = 18; const int off = 1 << logo; const int treesiz = off << 1; int n; int niz[maxn]; int sol[maxn]; int query(vector< int > v) { printf("%d ", v.size()); for (int tren : v) printf("%d ", tren); printf("\n"); fflush(stdout); int x; scanf("%d", &x); return x; } int main() { scanf("%d", &n); vector< int > v; v.push_back(1); sol[1] = 1; for (int i = 2; i <= n; i++) { int lo = 0; int hi = v.size(); while (lo < hi) { int mid = (lo + hi + 1) / 2; vector< int > tren; for (int j = 0; j < mid; j++) tren.push_back(v[j]); tren.push_back(i); int out = query(tren); if (out == tren.size()) lo = mid; else hi = mid - 1; } if (lo == v.size()) { v.push_back(i); sol[i] = v.size(); } else sol[i] = sol[v[lo]]; } printf("0 "); for (int i = 1; i <= n; i++) printf("%d ", sol[i]); printf("\n"); fflush(stdout); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 200 KB | Output is correct |
2 | Correct | 10 ms | 200 KB | Output is correct |
3 | Correct | 16 ms | 292 KB | Output is correct |
4 | Correct | 17 ms | 296 KB | Output is correct |
5 | Correct | 4 ms | 200 KB | Output is correct |
6 | Correct | 2 ms | 200 KB | Output is correct |
7 | Correct | 10 ms | 200 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 200 KB | Output is correct |
2 | Correct | 10 ms | 200 KB | Output is correct |
3 | Correct | 10 ms | 200 KB | Output is correct |
4 | Correct | 14 ms | 300 KB | Output is correct |
5 | Correct | 4 ms | 200 KB | Output is correct |
6 | Correct | 4 ms | 200 KB | Output is correct |
7 | Correct | 8 ms | 200 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 200 KB | Output is correct |
2 | Correct | 6 ms | 200 KB | Output is correct |
3 | Correct | 13 ms | 300 KB | Output is correct |
4 | Correct | 19 ms | 200 KB | Output is correct |
5 | Correct | 9 ms | 200 KB | Output is correct |
6 | Correct | 9 ms | 296 KB | Output is correct |
7 | Correct | 11 ms | 200 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 200 KB | Output is correct |
2 | Correct | 8 ms | 200 KB | Output is correct |
3 | Correct | 17 ms | 200 KB | Output is correct |
4 | Correct | 20 ms | 312 KB | Output is correct |
5 | Correct | 9 ms | 200 KB | Output is correct |
6 | Correct | 12 ms | 304 KB | Output is correct |
7 | Correct | 10 ms | 200 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 200 KB | Output is correct |
2 | Correct | 8 ms | 200 KB | Output is correct |
3 | Correct | 16 ms | 200 KB | Output is correct |
4 | Correct | 15 ms | 200 KB | Output is correct |
5 | Correct | 11 ms | 300 KB | Output is correct |
6 | Correct | 17 ms | 200 KB | Output is correct |
7 | Correct | 20 ms | 296 KB | Output is correct |