# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
166532 | 2019-12-02T17:31:21 Z | Lawliet | Carnival (CEOI14_carnival) | C++14 | 11 ms | 380 KB |
#include <bits/stdc++.h> using namespace std; const int MAXN = 150; int n; int qtdGroups; int myGroup[MAXN]; vector< int > costumes; vector< int > curQuery; vector< int > group[MAXN]; int query(int t) { if( t == 0 ) swap( curQuery , costumes ); printf("%d ",curQuery.size()); for(int i = 0 ; i < curQuery.size() ; i++) printf("%d ",curQuery[i]); printf("\n"); fflush( stdout ); int a; scanf("%d",&a); if( t == 0 ) swap( curQuery , costumes ); return a; } void createGroup(int i) { myGroup[ i ] = ++qtdGroups; group[ qtdGroups ].push_back( i ); } int bs(int k) { int l = 0; int r = costumes.size() - 1; while( l < r ) { int m = ( l + r )/2; curQuery.clear(); for(int i = l ; i <= m ; i++) curQuery.push_back( costumes[i] ); int qtd = curQuery.size(); curQuery.push_back( k ); if( query( 1 ) != qtd ) l = m + 1; else r = m; } return l; } int main() { scanf("%d",&n); createGroup( 1 ); costumes.push_back( 1 ); for(int i = 2 ; i <= n ; i++) { int qtd = costumes.size(); costumes.push_back( i ); if( query( 0 ) != qtd ) createGroup( i ); else { costumes.pop_back(); myGroup[ i ] = myGroup[ costumes[ bs(i) ] ]; } } printf("0 "); for(int i = 1 ; i <= n ; i++) printf("%d ",myGroup[i]); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 8 ms | 248 KB | Output is correct |
2 | Correct | 8 ms | 248 KB | Output is correct |
3 | Correct | 4 ms | 380 KB | Output is correct |
4 | Correct | 4 ms | 320 KB | Output is correct |
5 | Correct | 3 ms | 376 KB | Output is correct |
6 | Correct | 5 ms | 248 KB | Output is correct |
7 | Correct | 9 ms | 252 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 248 KB | Output is correct |
2 | Correct | 9 ms | 248 KB | Output is correct |
3 | Correct | 5 ms | 320 KB | Output is correct |
4 | Correct | 5 ms | 376 KB | Output is correct |
5 | Correct | 8 ms | 248 KB | Output is correct |
6 | Correct | 8 ms | 248 KB | Output is correct |
7 | Correct | 9 ms | 376 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 376 KB | Output is correct |
2 | Correct | 5 ms | 248 KB | Output is correct |
3 | Correct | 10 ms | 376 KB | Output is correct |
4 | Correct | 4 ms | 324 KB | Output is correct |
5 | Correct | 10 ms | 376 KB | Output is correct |
6 | Correct | 8 ms | 248 KB | Output is correct |
7 | Correct | 11 ms | 248 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 376 KB | Output is correct |
2 | Correct | 4 ms | 248 KB | Output is correct |
3 | Correct | 7 ms | 248 KB | Output is correct |
4 | Correct | 5 ms | 248 KB | Output is correct |
5 | Correct | 10 ms | 376 KB | Output is correct |
6 | Correct | 8 ms | 376 KB | Output is correct |
7 | Correct | 10 ms | 248 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 380 KB | Output is correct |
2 | Correct | 9 ms | 376 KB | Output is correct |
3 | Correct | 8 ms | 248 KB | Output is correct |
4 | Correct | 5 ms | 320 KB | Output is correct |
5 | Correct | 5 ms | 320 KB | Output is correct |
6 | Correct | 7 ms | 376 KB | Output is correct |
7 | Correct | 5 ms | 380 KB | Output is correct |