Submission #1245116

#TimeUsernameProblemLanguageResultExecution timeMemory
1245116guanex죄수들의 도전 (IOI22_prison)C++20
0 / 100
5 ms1092 KiB
#include "prison.h"

#include <vector>

#include<bits/stdc++.h>

using namespace std;


int getbit(int x){
  for(int i = 13; i >= 0; i--){
    if(x & (1 << i)){
      return i;
    }
  }
  return 01;
}

std::vector<std::vector<int>> devise_strategy(int N) {
  vector<vector<int>> ans(37);
  ans[0].push_back(0);
  ans[0].push_back(-1);
  for(int i = 2; i <= N; ++i){
    int call = getbit(i);
    ans[0].push_back((12 + (call >= 12? 12:0)));
  }
  ans[1].push_back(1);
  for(int i = 1; i <= N; ++i){
    bool on = (i & 2);
    if(on){
        ans[1].push_back(-1);
    }else{
      if(i & 1){
        ans[1].push_back(-1);
      }else{
        ans[1].push_back(-2);
      }
    }
  }
  ans[13].push_back(1);
  for(int i = 1; i <= N; ++i){
    bool on = (i & 2);
    if(!on){
        ans[13].push_back(-2);
    }else{
      if(i & 1){
        ans[13].push_back(-1);
      }else{
        ans[13].push_back(-2);
      }
    }
  }
  for(int i = 2; i <= 12; ++i){
    ans[i].push_back(1);
    for(int j = 1; j <= N; ++j){
      bool on = (j & (1 << i));
      if(on){
        ans[i].push_back(-1);
      }else{
        ans[i].push_back(24 + i - 1);
      }
    }
  }
  for(int i = 14; i <= 24; ++i){
    ans[i].push_back(1);
    for(int j = 1; j <= N; ++j){
      bool on = (j & (1 << i));
      if(!on){
        ans[i].push_back(-2);
      }else{
        ans[i].push_back(24 + i - 13);
      }
    }
  }
  for(int i = 25; i <= 36; ++i){
    ans[i].push_back(0);
    for(int j = 1; j <= N; ++j){
      bool on = j & (1 << (i - 24));
      if(on){
        ans[i].push_back(i - 24 + 12);
      }else{
        ans[i].push_back(i - 24);
      }
    }
  }
  return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...