제출 #634063

#제출 시각아이디문제언어결과실행 시간메모리
634063UtahaPrisoner Challenge (IOI22_prison)C++17
컴파일 에러
0 ms0 KiB
#include "prison.h"

#include <bits/stdc++.h>
using namespace std;

std::vector<std::vector<int>> devise_strategy(int N) {
  // 13 bits in total to check
  // check A ith bit: 0~12
  // check B ith bit, knowing A's ith bit = 0: 13~25
  // check B ith bit, knowing A's ith bit = 1: 26~38
  
  const int m = 13;
  const int checkA = 0;
  const int checkB0 = m;
  const int checkB1 = m + m;
  
  for (int i = 0; i < m; i++) {
    vector<int> v;
    v.clear();
    v.push_back(0); // bag A
    for (int j = 0; j < N; j++) {
      if (j & (1 << i)) {
        v.push_back(checkB1 + i);
      }
      else {
        v.push_back(checkB0 + i)
      }
    }
  }
  //checkB0
  for (int i = 0; i < m; i++) {
    vector<int> v;
    v.clear();
    v.push_back(1); // bag B
    for (int j = 0; j < N; j++) {
      if (j & (1 << i)) {
        v.push_back(-1); // report B > A
      }
      else {
        v.push_back(checkA + i + 1);
      }
    }
  }
  //checkB1
  for (int i = 0; i < m; i++) {
    vector<int> v;
    v.clear();
    v.push_back(1); // bag B
    for (int j = 0; j < N; j++) {
      if (j & (1 << i)) {
        v.push_back(checkA + i + 1);
      }
      else {
        v.push_back(-2); // report A > B
      }
    }
  }
  return v;
}

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

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:26:33: error: expected ';' before '}' token
   26 |         v.push_back(checkB0 + i)
      |                                 ^
      |                                 ;
   27 |       }
      |       ~                          
prison.cpp:58:10: error: 'v' was not declared in this scope
   58 |   return v;
      |          ^