# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
164889 | 2019-11-24T02:30:10 Z | arnold518 | Carnival (CEOI14_carnival) | C++14 | 32 ms | 568 KB |
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef pair<ll, ll> pll; const int MAXN = 150; int N, ans[MAXN+10], cnt; map<vector<int>, int> M; int ask(vector<int> V) { if(M.find(V)!=M.end()) return M[V]; printf("%d ", V.size()); for(auto it : V) printf("%d ", it); printf("\n"); fflush(stdout); int t; scanf("%d", &t); M[V]=t; return t; } bool query(int l, int r, int k) { int i; vector<int> V1, V2; for(i=l; i<=r; i++) V1.push_back(i), V2.push_back(i); V2.push_back(k); return ask(V1)==ask(V2); } int main() { int i, j; scanf("%d", &N); ans[1]=1; cnt=2; for(i=2; i<=N; i++) { if(!query(1, i-1, i)) ans[i]=cnt++; else { int lo=1, hi=i-1; while(lo<hi) { int mid=lo+hi>>1; if(query(lo, mid, i)) hi=mid; else lo=mid+1; } ans[i]=ans[lo]; } } printf("0 "); for(i=1; i<=N; i++) printf("%d ", ans[i]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 524 KB | Output is correct |
2 | Correct | 16 ms | 504 KB | Output is correct |
3 | Correct | 10 ms | 504 KB | Output is correct |
4 | Correct | 7 ms | 376 KB | Output is correct |
5 | Correct | 18 ms | 504 KB | Output is correct |
6 | Correct | 11 ms | 524 KB | Output is correct |
7 | Correct | 16 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 21 ms | 424 KB | Output is correct |
2 | Correct | 22 ms | 424 KB | Output is correct |
3 | Correct | 9 ms | 376 KB | Output is correct |
4 | Correct | 8 ms | 376 KB | Output is correct |
5 | Correct | 19 ms | 504 KB | Output is correct |
6 | Correct | 32 ms | 504 KB | Output is correct |
7 | Correct | 11 ms | 448 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 456 KB | Output is correct |
2 | Correct | 17 ms | 504 KB | Output is correct |
3 | Correct | 17 ms | 376 KB | Output is correct |
4 | Correct | 6 ms | 376 KB | Output is correct |
5 | Correct | 10 ms | 444 KB | Output is correct |
6 | Correct | 15 ms | 424 KB | Output is correct |
7 | Correct | 17 ms | 504 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 504 KB | Output is correct |
2 | Correct | 12 ms | 440 KB | Output is correct |
3 | Correct | 9 ms | 376 KB | Output is correct |
4 | Correct | 6 ms | 376 KB | Output is correct |
5 | Correct | 27 ms | 504 KB | Output is correct |
6 | Correct | 13 ms | 424 KB | Output is correct |
7 | Correct | 19 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 504 KB | Output is correct |
2 | Correct | 14 ms | 568 KB | Output is correct |
3 | Correct | 16 ms | 376 KB | Output is correct |
4 | Correct | 13 ms | 376 KB | Output is correct |
5 | Correct | 8 ms | 316 KB | Output is correct |
6 | Correct | 9 ms | 376 KB | Output is correct |
7 | Correct | 7 ms | 376 KB | Output is correct |