Submission #51979

#TimeUsernameProblemLanguageResultExecution timeMemory
51979diegogrcLast supper (IOI12_supper)C++17
Compilation error
0 ms0 KiB
#define MAX 100005 #define INF 1e9 struct nodo { int v, p; bool operator < ( const nodo & a ) const { return a.p > p; } }; bool activo[MAX]; int aparicion[MAX]; int sig[MAX]; int maxbits; priority_queue < nodo > q; void empuja( int x ) { for( int i = maxbits - 1; i >= 0; i -- ) { if( x & ( 1 << i ) ) WriteAdvice( 1 ); else WriteAdvice( 0 ); } } void ComputeAdvice(int *C, int N, int K, int M) { maxbits = ( int ) ceil( log2( N ) ); for( int i = 0; i < N; i ++ ) aparicion[i] = INF; for( int i = N-1; i >= 0; i -- ) { sig[i] = aparicion[C[i]]; aparicion[C[i]] = i; } for( int i = 0; i < K; i ++ ) { activo[i] = true; q.push( { i , aparicion[i] } ); } for( int i = 0; i < N; i ++ ) { int val = C[i]; if( activo[val] ) empuja( val ); else { nodo act = q.top(); activo[act.v] = false; q.pop(); empuja( act.v ); q.push( { val , sig[i] } ); activo[val] = true; } } }
void Assist(unsigned char *A, int N, int K, int R) { int numbits = ( int ) ceil( log2( N ) ); int idx = numbits - 1; for( int i = 0; i < N; i ++ ) { int color = GetRequest( ); int quita = 0; for( int j = 0; j < numbits; j ++ ) if( A[idx - j] == 1 ) quita += ( 1 << j ); if( quita != color ) PutBack( quita ); idx += numbits; } }

Compilation message (stderr)

advisor.cpp:16:1: error: 'priority_queue' does not name a type
 priority_queue < nodo > q;
 ^~~~~~~~~~~~~~
advisor.cpp: In function 'void empuja(int)':
advisor.cpp:23:13: error: 'WriteAdvice' was not declared in this scope
             WriteAdvice( 1 );
             ^~~~~~~~~~~
advisor.cpp:25:13: error: 'WriteAdvice' was not declared in this scope
             WriteAdvice( 0 );
             ^~~~~~~~~~~
advisor.cpp: In function 'void ComputeAdvice(int*, int, int, int)':
advisor.cpp:30:29: error: 'log2' was not declared in this scope
     maxbits = ( int ) ceil( log2( N ) );
                             ^~~~
advisor.cpp:30:29: note: suggested alternative: 'long'
     maxbits = ( int ) ceil( log2( N ) );
                             ^~~~
                             long
advisor.cpp:30:23: error: 'ceil' was not declared in this scope
     maxbits = ( int ) ceil( log2( N ) );
                       ^~~~
advisor.cpp:41:9: error: 'q' was not declared in this scope
         q.push( { i , aparicion[i] } );
         ^
advisor.cpp:50:24: error: 'q' was not declared in this scope
             nodo act = q.top();
                        ^

assistant.cpp: In function 'void Assist(unsigned char*, int, int, int)':
assistant.cpp:2:33: error: 'log2' was not declared in this scope
     int numbits = ( int ) ceil( log2( N ) );    
                                 ^~~~
assistant.cpp:2:33: note: suggested alternative: 'long'
     int numbits = ( int ) ceil( log2( N ) );    
                                 ^~~~
                                 long
assistant.cpp:2:27: error: 'ceil' was not declared in this scope
     int numbits = ( int ) ceil( log2( N ) );    
                           ^~~~
assistant.cpp:6:21: error: 'GetRequest' was not declared in this scope
         int color = GetRequest( );
                     ^~~~~~~~~~
assistant.cpp:12:13: error: 'PutBack' was not declared in this scope
             PutBack( quita );
             ^~~~~~~