# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
130282 | 2019-07-14T16:51:25 Z | DodgeBallMan | 사육제 (CEOI14_carnival) | C++14 | 22 ms | 376 KB |
#include <bits/stdc++.h> using namespace std; const int N = 200; int n, c, mark[N]; vector<int> all; int ask( vector<int> v ) { int ret; printf("%d ",v.size() ); for( int i = 0 ; i < ( int )v.size() - 1 ; i++ ) printf("%d ",v[i]); printf("%d\n",v[(int)v.size()-1]); fflush( stdout ); scanf("%d",&ret); return ret; } void process( int l, int r, int nu ) { //printf("L : %d R : %d\n",l,r); if( l == r ) { mark[all[l]] = c; return ; } int mid = ( l + r ) >> 1; vector<int> v, v2; for( int i = l ; i <= mid ; i++ ) v.emplace_back( all[i] ); for( int i = mid+1 ; i <= r ; i++ ) v2.emplace_back( all[i] ); int a = ask( v ), b = ask( v2 ); v.emplace_back( nu ), v2.emplace_back( nu ); int c = ask( v ), d = ask( v2 ); //printf("%d %d %d %d\n",a,b,c,d); if( c == 1 ) for( int i = 0 ; i < v.size() ; i++ ) mark[v[i]] = mark[nu]; if( d == 1 ) for( int i = 0 ; i < v2.size() ; i++ ) mark[v2[i]] = mark[nu]; if( a == c && c != 1 ) process( l, mid, nu ); if( b == d && d != 1 ) process( mid + 1, r, nu ); } int main() { scanf("%d",&n); for( int i = 1 ; i <= n ; i++ ) all.emplace_back( i ); for( int i = 1 ; i <= n ; i++ ) if( !mark[i] ) { ++c; all.erase( all.begin() ); mark[i] = c; int x = all.size(); if( x == 0 ) break; process( 0, x-1, i ); all.clear(); for( int j = 1 ; j <= n ; j++ ) if( !mark[j] ) all.emplace_back( j ); } printf("0 "); for( int i = 1 ; i <= n ; i++ ) printf("%d ",mark[i]); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 252 KB | Output is correct |
2 | Correct | 21 ms | 248 KB | Output is correct |
3 | Incorrect | 16 ms | 376 KB | Incorrect |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 376 KB | Output is correct |
2 | Correct | 22 ms | 376 KB | Output is correct |
3 | Incorrect | 13 ms | 248 KB | Incorrect |
4 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 18 ms | 376 KB | Output is correct |
3 | Correct | 13 ms | 248 KB | Output is correct |
4 | Incorrect | 13 ms | 376 KB | Incorrect |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 248 KB | Output is correct |
2 | Correct | 13 ms | 248 KB | Output is correct |
3 | Correct | 12 ms | 248 KB | Output is correct |
4 | Incorrect | 9 ms | 248 KB | Incorrect |
5 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 248 KB | Output is correct |
2 | Correct | 12 ms | 248 KB | Output is correct |
3 | Incorrect | 19 ms | 248 KB | Incorrect |
4 | Halted | 0 ms | 0 KB | - |