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 long long ll;
vector<vector<int> > devise_strategy(int N)
{
int u=0;
int d=N;
while(d>1){u++;d/=2;}
vector<vector<int> > s(3*u+1,vector<int>(N+1,0));
for(int i=1;i<=u;i++)
{
s[i][0]=1;
for(int j=1;j<=N;j++)
if(j&(1<<i))s[i][j]=-1;
else s[i][j]=2*u+i;
}
for(int i=1;i<=u;i++)
{
s[i+u][0]=1;
for(int j=1;j<=N;j++)
if(!(j&(1<<i)))s[i+u][j]=-2;
else s[i+u][j]=2*u+i;
}
for(int i=2;i<=u;i++)
{
s[2*u+i][0]=0;
for(int j=1;j<=N;j++)
if(j&(1<<(i-1)))s[2*u+i][j]=u+i-1;
else s[2*u+i][j]=i-1;
}
s[2*u+1][0]=0;
for(int j=1;j<=N;j++)
if((j&1))s[2*u+1][j]=-2;
else s[2*u+1][j]=-1;
s[0][0]=0;
for(int j=1;j<=N;j++)
if(j&(1<<u))s[0][j]=2*u;
else s[0][j]=u;
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... |