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 "prison.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define ll long long
#define pii pair<int, int>
#define ff first
#define ss second
int n;
vector<vector<int>> devise_strategy(int N) {
int X = 26;
vector<vector<int>> ans;
n = N;
for(int i=0; i<=X; i++){
ans.pb({});
for(int j=0; j<=N; j++){
ans[i].pb(0);
}
}
ans[0][0] = 0;
int k = 12;
for(int i=1; i<=n; i++){
if((i&(1<<k))) ans[0][i] = k + 14;
else ans[0][i] = k+1;
}
int ls = 1;
for(int i=k; i>=0; i--){
ans[i+1][0] = ls;
ans[i+14][0] = ls;
for(int j=1; j<=n; j++){
if((j&(1<<i))){
ans[i+1][j] = -(!ls + 1);
if((j & (1 << (i - 1)))) ans[i+14][j] = i + 13;
else ans[i+14][j] = i;
}
else{
ans[i+14][j] = -(ls + 1);
if((j & (1 << (i - 1)))) ans[i+1][j] = i + 13;
else ans[i+1][j] = i;
}
}
ls = !ls;
}
//for(int i=0; i<=X; i++){
// for(int j=0; j<=n; j++){
// cout<<ans[i][j]<<' ';
// }
// cout<<'\n';
//}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |