제출 #643600

#제출 시각아이디문제언어결과실행 시간메모리
643600keta_tsimakuridzePrisoner Challenge (IOI22_prison)C++17
72 / 100
16 ms1120 KiB
#include "prison.h"
#include <bits/stdc++.h>
using namespace std;
#include <vector>

std::vector<std::vector<int>> devise_strategy(int N) {


  vector<vector<int>> v;
  v.resize(3 * 8 , vector<int> (N + 1));
  int x = 2187, t = 1;
  for(int i = 1; i <= N; i++) {
    v[0][i] = i / x + 1;
  }
  for(int i = 1; i <= 24; i += 3) {
    // i , i + 1, i + 3 --- eseni aris
    for(int T = 0; T < 3; T++) {
        if(i + T == 24) continue;
        v[i + T][0] = t;
        for(int j = 1; j <= N; j++) {
            if(x == 1 || (j % (x * 3)) / x != T) {
                v[i + T][j] = ((j % (x * 3)) / x < T ? -t - 1 : -(1 - t) - 1);
            } else {
                if(x > 3 || (x == 3 && ((j % x) / (x / 3)) != 2))
                v[i + T][j] = i + 3 + ((j % x) / (x / 3));
                else if(x == 3 && ((j % x) / (x / 3)) == 2) v[i + T][j] = -(1 - t) - 1;
            }
        }
    }

    x /= 3; t ^= 1;
  }
  return v;

}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...