Submission #634064

#TimeUsernameProblemLanguageResultExecution timeMemory
634064UtahaPrisoner Challenge (IOI22_prison)C++17
Compilation error
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;
}

Compilation message (stderr)

prison.cpp: In function 'std::vector<std::vector<int> > devise_strategy(int)':
prison.cpp:58:10: error: 'v' was not declared in this scope
   58 |   return v;
      |          ^