제출 #670465

#제출 시각아이디문제언어결과실행 시간메모리
670465MilosMilutinovicPrisoner Challenge (IOI22_prison)C++17
47 / 100
15 ms1372 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(33, vector<int>(N + 1)); for (int i = 0; i < 33; 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 >= 31) { 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); strategy[i][j] = (me < he ? -my_bag : (me > he ? -his_bag : i + (i % 2) + 1 + (j >> (12 - bit) & 1))); } } else { assert(i > 0); 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); strategy[i][j] = (me < he ? -my_bag : (me > he ? -his_bag : i + (i % 2) + 1 + (j >> (12 - bit) & 1))); } } } return strategy; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...