Submission #1008232

#TimeUsernameProblemLanguageResultExecution timeMemory
1008232oyberPrisoner Challenge (IOI22_prison)C++17
0 / 100
1 ms432 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> devise_strategy(int N) { vector<vector<int>> s(32); for (int i = 2; i < 32; i++) { s[i].resize(N+1); int counter = i >> 1; int other = i & 1; int bag = counter % 2; s[i][0] = bag; for (int j = 1; j <= N; j++) { int bit = (j & (1 << counter)) > 0; if (bit == other) { if (counter == 1) { int last_bit = j & 1; int lowest = bag; if (last_bit == 1) lowest = !bag; s[i][j] = -(lowest+1); } else { int new_counter = counter-1; int new_other = (j & (j << new_counter)) > 0; s[i][j] = (new_counter << 1) + new_other; } } else { int lowest = bag; if (other < bit) lowest = !lowest; s[i][j] = -(lowest+1); } } } s[0].resize(N+1); s[1].resize(N+1); s[0][0] = 0; int counter = 31 >> 1; for (int j = 1; j <= N; j++) { int bit = (j & (1 << counter)) > 0; s[0][j] = (counter << 1) + bit; } return s; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...