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 int ll;
vector<vector<ll>> devise_strategy(ll n){
vector<vector<ll>> v(24, vector<ll> (n+1, 0));
for(ll i=0; i<24; i++){
if(i%4==0 || i%4==1) v[i][0]=0;
else v[i][0]=1;
}
for(ll i=1; i<=n; i++){
if(i>=4096) v[0][i]=23;
else v[0][i]=22;
}
for(ll i=1; i<=n; i++){
if(i%4>=2) v[1][i]=-2;
else v[1][i]=-1;
}
for(ll i=2; i<=3; i++){
for(ll j=1; j<=n; j++){
ll k=2, b=i%2, bj;
if((j & (1<<k))>0) bj=1;
else bj=0;
if(b==bj){
if(j%4==3) v[i][j]=-1;
else if(j%4==0) v[i][j]=-2;
else v[i][j]=1;
}
else if(bj==1) v[i][j]=-1;
else v[i][j]=-2;
}
}
for(ll i=4; i<24; i++){
for(ll j=1; j<=n; j++){
ll k=i/2+1, b=i%2, bj, bj1;
if((j&(1<<k))>0) bj=1;
else bj=0;
if(b==bj){
if((j & (1<<(k-1)))>0) bj1=1;
else bj1=0;
v[i][j]=2*k-4+bj1;
}
else if(bj==1){
if(k%2==0) v[i][j]=-1;
else v[i][j]=-2;
}
else{
if(k%2==0) v[i][j]=-2;
else v[i][j]=-1;
}
}
}
for(ll i=0; i<24; i++){
if(v[i][0]==0) {
v[i][n]=-2;
v[i][1]=-1;
}
else {
v[i][n]=-1;
v[i][1]=-2;
}
}
return v;
}
//~ int main(){
//~ ll n;
//~ cin>>n;
//~ vector<vector<ll>> v=devise_strategy(n);
//~ for(ll i=0; i<24; i++){
//~ cout<<i<<" : ";
//~ for(ll j=0; j<=n; j++){
//~ cout<<v[i][j]<<" ";
//~ }
//~ cout<<endl;
//~ }
//~ return 0;
//~ }
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |