Submission #642029

#TimeUsernameProblemLanguageResultExecution timeMemory
642029VanillaPrisoner Challenge (IOI22_prison)C++17
53 / 100
15 ms1236 KiB
#include <bits/stdc++.h> #include "prison.h" using namespace std; int x = 14; vector<vector<int>> devise_strategy(int N) { vector <vector <int> > rs (2 * x + 1, vector <int> (N + 1, 0)); rs[0][0] = 0; for (int i = 1; i <= N; i++){ rs[0][i] = ((i & (1 << x)) ? 2: 1); } for (int i = 1, bit = x; i <= 2 * x; i++){ int open = ((i + 1) / 2) % 2; rs[i][0] = open; // cout << i << " " << bit << "\n"; if (i % 2 == 1) { // bit unset for (int j = 1; j <= N; j++){ if (j & (1 << (bit - 1))){ rs[i][j] = -(!open) - 1; } else { if (j & (1 << (bit - 2))) { rs[i][j] = i + 3; } else rs[i][j] = i + 2; } } } else { for (int j = 1; j <= N; j++){ // bit set // clog << "> " << j << "\n"; if (j & (1 << (bit - 1))) { if (j & (1 << (bit - 2))) { rs[i][j] = i + 2; } else rs[i][j] = i + 1; } else { rs[i][j] = -open - 1; } } bit--; } } for (int i = 0; i <= 2 * x; i++){ for (int j = 0; j < N + 1; j++){ if (rs[i][j] > 2 * x) rs[i][j] = -1; } // cout << "\n"; } return rs; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...