이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
const int x=23;
int pot[10];
vector<vector<int>> devise_strategy(int n){
pot[0]=1;
for(int i=1; i<10; i++) pot[i] = pot[i-1]*3;
vector<vector<int>> w;
w.resize(x);
for(int i=0; i<x; i++) w[i].resize(n+1);
for(int i=0; i<x; i++){
if(i%6==0||i%6==4||i%6==5) w[i][0] = 0;
else w[i][0] = 1;
}
for(int j=0; j<n; j++){
w[0][j+1] = j/pot[7] + 1;
}
for(int i=1; i<x-4; i++){
int ktora = (i+2)/3;
int mod = (i+2)%3;
int po = 8-ktora;
for(int j=0; j<n; j++){
int cyfra = (j/(pot[po]))%3;
if(cyfra < mod){
if(w[i][0]==1) w[i][j+1]=-2;
else w[i][j+1]=-1;
}
if(cyfra > mod){
if(w[i][0]==1) w[i][j+1]=-1;
else w[i][j+1]=-2;
}
if(cyfra==mod){
w[i][j+1] = 3 * ktora + 1 + ((j/pot[po-1])%3);
}
}
}
for(int i=x-4; i<x-1; i++){
int mod = (i+2)%3;
for(int j=0; j<n; j++){
int cyfra = (j%9)/3;
if(cyfra < mod || ((cyfra==mod)&&j%3==0)){
if(w[i][0]==1) w[i][j+1]=-2;
else w[i][j+1]=-1;
}
if(cyfra > mod|| ((cyfra==mod)&&j%3==2)){
if(w[i][0]==1) w[i][j+1]=-1;
else w[i][j+1]=-2;
}
if(cyfra == mod&&j%3==1){
w[i][j+1]=x-1;
}
}
}
for(int j=0; j<n; j++){
if(j%3==0) w[x-1][j+1] = -1;
else w[x-1][j+1]=-2;
}
return w;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |