Submission #813448

#TimeUsernameProblemLanguageResultExecution timeMemory
813448HaroldVemenoPrisoner Challenge (IOI22_prison)C++17
65 / 100
11 ms1108 KiB
#include "prison.h" #include <bits/stdc++.h> #ifdef GUDEB #define D(x) cerr << #x << ": " << (x) << '\n'; #define ifdeb if(true) #else #define D(x) ; #define ifdeb if(false) #endif #define all(x) begin(x), end(x) using namespace std; using ull = unsigned long long; using ll = long long; // #define int ll; int p3[10]; vector<vector<int>> devise_strategy(int n) { p3[0] = 1; for(int i = 1; i < 10; ++i) { p3[i] = p3[i-1] * 3; } vector<vector<int>> str(25, vector<int>(n+1)); str[0][0] = 0; for(int i = 0; i < n; ++i) { str[0][i+1] = 1 + (i/p3[7] % 3); } for(int k = 1; k <= 22; k += 3) { int p = (22-k)/3; for(int r = 0; r < 3; ++r) { str[k+r][0] = k % 2; for(int i = 0; i < n; ++i) { if(i/p3[p] % 3 < r) { str[k+r][i+1] = -1 - (k % 2); } else if(i/p3[p] % 3 > r) { str[k+r][i+1] = -1 - ((k+1)%2); } else { if(p != 0) str[k+r][i+1] = k+3+((i/p3[p-1]) % 3); } } } } return str; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...