이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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==3) v[1][i]=-2;
else if(i%4==0) v[1][i]=-1;
else if(i%4==1) v[1][i]=-1;
else v[1][i]=-2;
}
for(ll i=2; i<4; 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==0) v[i][j]=-1;
else if(j%4==3) v[i][j]=-2;
else v[i][j]=1;
}
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=4; i<24; i++){
for(ll j=1; j<=n; j++){
ll k=i/2+1, b=i%2, bj;
if((j & (1<<k))>0) bj=1;
else bj=0;
if(b==bj){
ll bj1=0;
if((j & (1<<(k-1)))>0) bj1=1;
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;
}
}
}
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... |