Submission #670476

#TimeUsernameProblemLanguageResultExecution timeMemory
670476MilosMilutinovic죄수들의 도전 (IOI22_prison)C++17
0 / 100
1 ms212 KiB
#include "prison.h"
#include <bits/stdc++.h>

using namespace std;

vector<vector<int>> devise_strategy(int N) {
  vector<int> seq(13, 2);
  vector<vector<int>> strategy(24, vector<int>(N + 1));
  for (int i = 0; i < 24; i++) {
    int bit = (i + 1) / 2;
    int player = (bit % 2 == 0 ? 0 : 1);
    strategy[i][0] = player;
    for (int j = 1; j <= N; j++) {
      if (i >= 24) {
        strategy[i][j] = 0;
        continue;
      }
      if (player == 0) {
        if (i == 0) {
          strategy[i][j] = 1 + (j >> (12 - bit) & 1);
        } else {
          int he = 1 - (i % 2);
          int me = (j >> (12 - (bit - 1)) & 1);
          int my_bag = (player == 0 ? 1 : 2);
          int his_bag = (my_bag ^ 1 ^ 2);
          int cc = (j >> (12 - bit) & 1);
          if (bit == 12) {
            strategy[i][j] = (me < he ? -my_bag : (me > he ? -his_bag : (cc == 0 ? -my_bag : -his_bag)));
          } else {
            strategy[i][j] = (me < he ? -my_bag : (me > he ? -his_bag : i + (i % 2) + 1 + cc));
          }
        }
      } else {
        int he = 1 - (i % 2);
        int me = (j >> (12 - (bit - 1)) & 1);
        int my_bag = (player == 0 ? 1 : 2);
        int his_bag = (my_bag ^ 1 ^ 2);
        int cc = (j >> (12 - bit) & 1);
        if (bit == 12) {
          strategy[i][j] = (me < he ? -my_bag : (me > he ? -his_bag : (cc == 0 ? -my_bag : -his_bag)));
        } else {
          strategy[i][j] = (me < he ? -my_bag : (me > he ? -his_bag : i + (i % 2) + 1 + cc));
        }
      }
    }
  }
  return strategy;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...