답안 #564858

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
564858 2022-05-19T20:02:09 Z Uzouf 질문 (CEOI14_question_grader) C++14
컴파일 오류
0 ms 0 KB
int encode(int n,int x,int y) {
  int grid[12][924];
        int col=-1;
        for (int msk=0;msk<(1<<12);msk++) {
          if (__builtin_popcount(msk)!=6) continue;
          col++;
          for (int i=0;i<12;i++) {
            if ((msk&(1<<i))==(1<<i)) grid[i][col]=1;
            else grid[i][col]=0;
          }
        }
 
        int h;
        for (int j=0;j<12;j++) {
          if (grid[j][x-1]==1 && grid[j][y-1]==0) {
            h=j+1; break;
          }
        }
  return h;
}
int decode(int n,int q,int h) {
  h--; q--;
 
  int grid[12][924];
  int col=-1;
  for (int msk=0;msk<(1<<12);msk++) {
    if (__builtin_popcount(msk)!=6) continue;
    col++;
    vector<int> v;
    for (int i=0;i<12;i++) {
      if ((msk&(1<<i))==(1<<i)) grid[i][col]=1;
      else grid[i][col]=0;
    }
  }
 
  return grid[h][q];
}

Compilation message

encoder.cpp: In function 'int encode(int, int, int)':
encoder.cpp:19:10: warning: 'h' may be used uninitialized in this function [-Wmaybe-uninitialized]
   19 |   return h;
      |          ^

decoder.cpp: In function 'int decode(int, int, int)':
decoder.cpp:9:5: error: 'vector' was not declared in this scope
    9 |     vector<int> v;
      |     ^~~~~~
decoder.cpp:9:12: error: expected primary-expression before 'int'
    9 |     vector<int> v;
      |            ^~~