This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |