Submission #1055976

#TimeUsernameProblemLanguageResultExecution timeMemory
1055976tolbiPrisoner Challenge (IOI22_prison)C++17
60 / 100
12 ms1116 KiB
#include "prison.h" #include <bits/stdc++.h> using namespace std; #define tol(bi) (1ll<<((int)(bi))) constexpr int LOG = 13; vector<vector<int>> devise_strategy(int N) { vector<vector<int>> ret(LOG*2,vector<int>(N+1)); for (int i = 0; i < LOG*2; i++){ int curbit = i>>1; int bionceki = i&1; int oncekibit = (LOG-1)-curbit+1; int bubit = (LOG-1)-curbit; for (int j = 1; j <= N; j++){ if ((curbit&1)==0){ ret[i][0]=0; if (!!(j&tol(oncekibit)) != bionceki){ if (bionceki) ret[i][j]=-1; else ret[i][j]=-2; } else { if (bubit==0) ret[i][j]=(j&tol(bubit))?-2:-1; else ret[i][j]=curbit*2+2+(!!(j&tol(bubit))); } } else { ret[i][0]=1; if (!!(j&tol(oncekibit)) != bionceki){ if (bionceki) ret[i][j]=-2; else ret[i][j]=-1; } else { if (bubit==0) ret[i][j]=(j&tol(bubit))?-1:-2; else ret[i][j]=curbit*2+2+(!!(j&tol(bubit))); } } } } return ret; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...