이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anthony.h"
#include <vector>
#include <algorithm>
using namespace std;
namespace {
const int MAXN=20005;
const int INF=19260817;
vector<int> g[MAXN];
int dep[MAXN],par[MAXN],col[MAXN],stat[MAXN];
const int arr[]={0,0,1,0,1,1};
void dfs(int x){
stat[x]=stat[par[x]]+1,(stat[x]==6)?(stat[x]=0):(0);
col[x]=arr[stat[x]];
if (g[x].size()>2)
stat[x]=(col[x])?(0):(1);
for (auto v:g[x]){
if (v==par[x])
continue;
dep[v]=dep[x]+1,par[v]=x;
dfs(v);
}
}
} // namespace
vector<int> Mark(int n,int m,int a,int b,vector<int> U,vector<int> V){
for (int i=0;i<m;i++){
g[U[i]].push_back(V[i]);
g[V[i]].push_back(U[i]);
}
dfs(0);
vector<int> anss;
for (int i=0;i<m;i++){
int ncol;
int u=U[i];
int v=V[i];
if (u==par[v])
ncol=col[v];
if (v==par[u])
ncol=col[u];
anss.push_back(ncol);
}
return anss;
}
#include "Catherine.h"
#include <vector>
using namespace std;
namespace {
int a,b;
int moves;
int lstmv;
int detecting;
const int arr[]={0,0,1,0,1,1};
int detect_val=0;
} // namespace
void Init(int A,int B){
a=A;
b=B;
moves=0;
lstmv=-1;
detecting=0;
}
int Move(vector<int> y) {
int hscnt=0;
for (int i=0;i<a;i++){
hscnt+=y[i];
}
if (!moves){
moves++;
if (hscnt>2){
detecting=39;
return (lstmv=(y[1]<y[0]));
}
if (hscnt==1){
detecting=39;
return (lstmv=(!(!y[1])));
}
detecting=1;
if (y[0]==2)
lstmv=0,detect_val=0;
else if (y[0]==1)
lstmv=0,detect_val=2;
else
lstmv=1,detect_val=3;
return lstmv;
}
moves++;
if (detecting<3){
detecting++;
if (!hscnt){
detecting=39;
return -1;
}
if (hscnt+1>2){
detecting=39;
y[lstmv]++;
if (y[0]>y[1]){
lstmv=1;
return (lstmv==1)?(-1):(1);
}
lstmv=0;
return (lstmv==0)?(-1):(0);
}
(y[0])?(lstmv=0):(lstmv=1);
detect_val=detect_val*2+lstmv;
return lstmv;
}
if (detecting==3){
detecting=39;
if (!hscnt)
return -1;
if (hscnt+1>2){
y[lstmv]++;
if (y[0]>y[1]){
lstmv=1;
return (lstmv==1)?(-1):(1);
}
lstmv=0;
return (lstmv==0)?(-1):(0);
}
if (detect_val==5 || detect_val==18 || detect_val==25 || detect_val==11
|| detect_val==22 || detect_val==12)
return -1;
(y[0])?(lstmv=0):(lstmv=1);
return lstmv;
}
if (!hscnt)
return -1;
if (hscnt==1){
(y[0])?(lstmv=0):(lstmv=1);
return lstmv;
}
y[lstmv]++;
lstmv=(y[0]>y[1]);
return lstmv;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |