제출 #166667

#제출 시각아이디문제언어결과실행 시간메모리
166667Lawliet질문 (CEOI14_question_grader)C++14
컴파일 에러
0 ms0 KiB
bool isActive(int v, int k) { return v & (1 << k); } int encode (int n, int x, int y) { int cnt = 1; for(int m = 0 ; cnt <= n ; m++) if( __builtin_popcount( m ) == 6 ) mask[ cnt++ ] = m; x = mask[ x ]; y = mask[ y ]; for(int j = 0 ; j < 12 ; j++) if( isActive( x , j ) && !isActive( y , j ) ) return j + 1; }
bool isActive(int v, int k) { return v & (1 << k); } int decode (int n, int q, int h) { h--; int cnt = 1; for(int m = 0 ; cnt <= n ; m++) if( __builtin_popcount( m ) == 6 ) mask[ cnt++ ] = m; if( isActive( mask[ q ] , h ) ) return 1; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:8:40: error: 'mask' was not declared in this scope
     if( __builtin_popcount( m ) == 6 ) mask[ cnt++ ] = m;
                                        ^~~~
encoder.cpp:10:7: error: 'mask' was not declared in this scope
   x = mask[ x ];
       ^~~~
encoder.cpp:15:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:9:40: error: 'mask' was not declared in this scope
     if( __builtin_popcount( m ) == 6 ) mask[ cnt++ ] = m;
                                        ^~~~
decoder.cpp:11:16: error: 'mask' was not declared in this scope
  if( isActive( mask[ q ] , h ) ) return 1;
                ^~~~