Submission #950802

#TimeUsernameProblemLanguageResultExecution timeMemory
950802Dec0DeddPrisoner Challenge (IOI22_prison)C++17
36.50 / 100
19 ms1628 KiB
#include <bits/stdc++.h> #include "prison.h" using namespace std; typedef long long ll; typedef pair<int, int> pii; const int K = 13; vector<vector<int>> devise_strategy(int n) { vector<vector<int>> res(3*K+1, vector<int>(n+1, 0)); // 3*i+1 - ith bit in A // 3*i+2 - ith bit set in A // 3*i+3 - ith bit not set in A res[0][0]=0; for (int i=1; i<=n; ++i) res[0][i]=3*(K-1)+1; for (int i=0; i<=K-1; ++i) { int s=3*i+1; res[s][0]=0; for (int j=1; j<=n; ++j) { if (j&(1<<i)) res[s][j]=3*i+2; else res[s][j]=3*i+3; } s=3*i+2; res[s][0]=1; for (int j=1; j<=n; ++j) { if (j&(1<<i)) res[s][j]=3*(i-1)+1; else res[s][j]=-2; } s=3*i+3; res[s][0]=1; for (int j=1; j<=n; ++j) { if (j&(1<<i)) res[s][j]=-1; else res[s][j]=3*(i-1)+1; } } //cout<<"size "<<res.size()<<"\n"; return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...