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>
using namespace std;
typedef int ll;
#define rep(i, a, b) for(ll i=ll(a); i<ll(b); i++)
#define repn(i, a, b) for(ll i=ll(b)-1; i>=ll(a); i--)
#define all(v) (v.begin(), v.end())
#define pb push_back
#define ff first
#define ss second
vector<vector<ll>> devise_strategy(int n){
ll x=24;
vector<vector<ll>> s(x, vector<ll> (n+1));
rep(i, 0, x){
if(i%4==0 || i%4==1){
s[i][0]=0;
}
else{
s[i][0]=1;
}
}
rep(j, 1, n+1){
if(j%4>=2) s[1][j]=-1;
else s[1][j]=-2;
}
rep(i, 2, 4){
rep(j, 1, n+1){
ll k=j/4%2;
if(k==1 && i==2){
s[i][j]=-1;
}
else if(k==0 && i==3){
s[i][j]=-2;
}
else{
if(k%4==0){
s[i][j]=-2;
}
else if(k%4==3){
s[i][j]=-1;
}
else{
s[i][j]=1;
}
}
}
}
vector<ll> pw(x, 1);
rep(i, 1, x){
pw[i]=2*pw[i-1];
}
rep(i, 4, x){
ll a=(i+2)/2;
rep(j, 1, n+1){
if(i%2==0){
if((j&pw[a])>0){
if(i%4==2){
s[i][j]=-1;
}
else{
s[i][j]=-2;
}
}
else{
s[i][j]=i-2;
if((j&pw[a-1])>0) s[i][j]++;
}
}
else{
if((j&pw[a])>0){
s[i][j]=i-3;
if((j&pw[a-1])>0) s[i][j]++;
}
else{
if(i%4==1){
s[i][j]=-1;
}
else{
s[i][j]=-2;
}
}
}
}
}
return s;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |