Submission #166670

#TimeUsernameProblemLanguageResultExecution timeMemory
166670LawlietQuestion (Grader is different from the original contest) (CEOI14_question_grader)C++14
100 / 100
1616 ms114568 KiB
int mask[930]; bool preCalculate; bool isActive(int v, int k) { return v & (1 << k); } int encode (int n, int x, int y) { if( !preCalculate ) { int cnt = 1; for(int m = 0 ; cnt <= n ; m++) if( __builtin_popcount( m ) == 6 ) mask[ cnt++ ] = m; preCalculate = true; } x = mask[ x ]; y = mask[ y ]; for(int j = 0 ; j < 12 ; j++) if( isActive( x , j ) && !isActive( y , j ) ) return j + 1; }
int mask[930]; bool preCalculate; bool isActive(int v, int k) { return v & (1 << k); } int decode (int n, int q, int h) { h--; if( !preCalculate ) { int cnt = 1; for(int m = 0 ; cnt <= n ; m++) if( __builtin_popcount( m ) == 6 ) mask[ cnt++ ] = m; preCalculate = true; } if( isActive( mask[ q ] , h ) ) return 1; return 0; }

Compilation message (stderr)

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:13:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for(int m = 0 ; cnt <= n ; m++)
     ^~~
encoder.cpp:16:7: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
       preCalculate = true;
       ^~~~~~~~~~~~
encoder.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:15:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
     for(int m = 0 ; cnt <= n ; m++)
     ^~~
decoder.cpp:18:7: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
       preCalculate = true;
       ^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...