#include "Anthony.h"
#include <bits/stdc++.h>
namespace {
std::vector<std::vector<int>> edges;
std::map<std::pair<int,int>,int> eids;
std::vector<int> marks;
void dfs(int cur,int parent,int prog){
if(cur!=0)marks[eids[{cur,parent}]]=(13>>(prog%6))&1;
int oldm=(13>>(prog%6))&1;
int nprog=edges[cur].size()==2?prog+1:oldm?4:0;
for(int i:edges[cur]){
if(i==parent)continue;
dfs(i,cur,nprog);
}
}
} // namespace
/*
DFS tree?
101100 away from node 0
001101 along the branches of the tree - if you are going the wrong way, it will be reversed
001101
01100
11001
10010
00101
01011
10110
all appear only in reverse
If you see one of the rotations of it, go back the other way
*/
std::vector<int> Mark(int N, int M, int A, int B,
std::vector<int> U, std::vector<int> V) {
marks.resize(M);
edges.resize(N);
for(int i=0;i<M;i++){
eids[{U[i],V[i]}]=i;
eids[{V[i],U[i]}]=i;
edges[U[i]].push_back(V[i]);
edges[V[i]].push_back(U[i]);
}
dfs(0,0,0);
//for(int i:marks)std::cout<<i<<'\n';
return marks;
}
#include "Catherine.h"
#include <bits/stdc++.h>
namespace {
int num=0;
int last6=-1;
int last=0;
} // namespace
/*
001101
*/
void Init(int A, int B) {
}
int Move(std::vector<int> y) {
/*
std::cout<<"move "<<last<<'\n';
std::cout<<last6<<'\n';
std::cout<<"seen\n";
for(int i:y){
std::cout<<i<<' ';
}
std::cout<<'\n';
*/
if(num==0){
if(y[0]+y[1]==2){
if(y[1]==0){
last6=0;
last=0;
}else if(y[1]==1){
last6=1;
last=1;
}else if(y[1]==2){
last6=3;
last=1;
}
num=2;
return last;//don't care
}else{
num=-1e9;
last=y[1]==1;
return last;//what appears once
}
}
if(y[0]+y[1]>=2){
num=-1e9;
int n=y[1];
int move=n==1?!last:-1;
last=n==1?!last:last;
return move;
}else if(y[0]+y[1]==1){
last6<<=1;last6+=y[1];num++;
if(num==5){
if(last6==12||last6==25||last6==18||last6==5||last6==11||last6==22){
num=-1e9;
last=last;
return -1;
}
}
last=y[1];
return last;
}else{
num=-1e9;last=last;
return -1;
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
40 ms |
19288 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
40 ms |
19288 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
38 ms |
16448 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
38 ms |
16448 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
1048 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
43 ms |
14188 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
41 ms |
14288 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |