#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
string str="001011";
const int N=20005;
vector<int> v,adj[N+1],deg(N),e(N);
const int INF=1e9;
void dfs(int k,int pa,int dis,int up){
for(int i:adj[k]){
int j=e[i]^k;
if(j==pa)continue;
if(deg[k]<=2){
v[i]=str[dis%6]-'0';
dfs(j,k,dis+1,v[i]);
}
else{
v[i]=up^1;
if(v[i]==1)dfs(j,k,3,v[i]);
else dfs(j,k,1,v[i]);
}
}
}
vector<int> Mark(int N, int M, int A, int B,vector<int> U, vector<int> V) {
v.resize(M,-1);
queue<int> q;
vector<int> dis(N+1,INF);
for(int i=0;i<M;i++){
adj[U[i]].push_back(i);
adj[V[i]].push_back(i);
deg[U[i]]++;
deg[V[i]]++;
e[i]=U[i]^V[i];
}
dfs(0,0,0,0);
return v;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
int last=-1,sure=0;
vector<int> tmp={0,0,1,0,1,1};
vector<int> rec;
void Init(int A, int B) {
}
int Move(vector<int> y) {
//cout<<y[0]<<' '<<y[1]<<' '<<last<<endl;
if(sure){
int tot=y[0]+y[1];
if(min(y[0],y[1])==0){
return last=(y[0]?0:1);
}
else{
if(y[last^1]==0)cout<<"NO"<<endl;
return last=last^1;
}
}
if(last==-1){
int tot=y[0]+y[1];
if(tot==1){
sure=1;
last=(y[0]?0:1);
return last;
}
else if(tot==2){
if(y[0]&&y[1]){
rec.push_back(0);
rec.push_back(1);
return last=1;
}
else if(y[0]==2){
rec.push_back(0);
rec.push_back(0);
return last=0;
}
else{
rec.push_back(1);
rec.push_back(1);
return last=1;
}
}
else{
sure=1;
last=(y[0]>y[1]?1:0);
assert(y[last]!=0);
return last;
}
}
else{
int tot=y[0]+y[1];
if(tot==0){
sure=1;
return -1;
}
else if(tot==1){
rec.push_back((y[0]?0:1));
if(rec.size()==5){
int flag=0;
for(int i=0;i<6;i++){
vector<int> a(tmp.begin(),tmp.begin()+5);
if(a==rec){
flag=1;
break;
}
rotate(tmp.begin(),tmp.begin()+1,tmp.end());
}
if(flag==0){
sure=1;
return last=(y[0]?0:1);
}
else{
sure=1;
return -1;
}
}
else{
last=(y[0]?0:1);
return last;
}
}
else{
y[last]++;
if(y[0]==1){
int t=(last==0?-1:0);
last=0;
sure=1;
return t;
}
else{
int t=(last==1?-1:1);
last=1;
sure=1;
return t;
}
}
}
assert(false);
}
Compilation message
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:14:7: warning: unused variable 'tot' [-Wunused-variable]
14 | int tot=y[0]+y[1];
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
27 ms |
16512 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
27 ms |
16512 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
14204 KB |
Output is correct |
2 |
Correct |
1 ms |
1560 KB |
Output is correct |
3 |
Correct |
22 ms |
12916 KB |
Output is correct |
4 |
Correct |
33 ms |
16256 KB |
Output is correct |
5 |
Correct |
34 ms |
16112 KB |
Output is correct |
6 |
Incorrect |
25 ms |
13940 KB |
Wrong Answer [6] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
14204 KB |
Output is correct |
2 |
Correct |
1 ms |
1560 KB |
Output is correct |
3 |
Correct |
22 ms |
12916 KB |
Output is correct |
4 |
Correct |
33 ms |
16256 KB |
Output is correct |
5 |
Correct |
34 ms |
16112 KB |
Output is correct |
6 |
Incorrect |
25 ms |
13940 KB |
Wrong Answer [6] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1564 KB |
Output is correct |
2 |
Correct |
1 ms |
1296 KB |
Output is correct |
3 |
Correct |
1 ms |
1568 KB |
Output is correct |
4 |
Correct |
2 ms |
1816 KB |
Output is correct |
5 |
Correct |
2 ms |
1816 KB |
Output is correct |
6 |
Correct |
2 ms |
1816 KB |
Output is correct |
7 |
Correct |
2 ms |
1820 KB |
Output is correct |
8 |
Correct |
2 ms |
1812 KB |
Output is correct |
9 |
Correct |
2 ms |
1816 KB |
Output is correct |
10 |
Correct |
2 ms |
1812 KB |
Output is correct |
11 |
Correct |
1 ms |
1816 KB |
Output is correct |
12 |
Correct |
1 ms |
1816 KB |
Output is correct |
13 |
Correct |
2 ms |
1816 KB |
Output is correct |
14 |
Correct |
2 ms |
1808 KB |
Output is correct |
15 |
Correct |
2 ms |
1824 KB |
Output is correct |
16 |
Correct |
1 ms |
1560 KB |
Output is correct |
17 |
Correct |
2 ms |
1580 KB |
Output is correct |
18 |
Correct |
2 ms |
1568 KB |
Output is correct |
19 |
Correct |
2 ms |
1560 KB |
Output is correct |
20 |
Correct |
2 ms |
1808 KB |
Output is correct |
21 |
Correct |
2 ms |
1568 KB |
Output is correct |
22 |
Correct |
2 ms |
1568 KB |
Output is correct |
23 |
Correct |
2 ms |
1564 KB |
Output is correct |
24 |
Correct |
2 ms |
1560 KB |
Output is correct |
25 |
Correct |
1 ms |
1568 KB |
Output is correct |
26 |
Correct |
2 ms |
1560 KB |
Output is correct |
27 |
Correct |
2 ms |
1784 KB |
Output is correct |
28 |
Correct |
2 ms |
1820 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
25 ms |
11372 KB |
Output is correct |
2 |
Correct |
27 ms |
12752 KB |
Output is correct |
3 |
Correct |
1 ms |
1296 KB |
Output is correct |
4 |
Correct |
20 ms |
11384 KB |
Output is correct |
5 |
Correct |
32 ms |
14720 KB |
Output is correct |
6 |
Correct |
31 ms |
14708 KB |
Output is correct |
7 |
Correct |
28 ms |
13684 KB |
Output is correct |
8 |
Correct |
26 ms |
13688 KB |
Output is correct |
9 |
Correct |
31 ms |
14704 KB |
Output is correct |
10 |
Correct |
32 ms |
14716 KB |
Output is correct |
11 |
Correct |
30 ms |
14740 KB |
Output is correct |
12 |
Correct |
30 ms |
14716 KB |
Output is correct |
13 |
Correct |
32 ms |
14576 KB |
Output is correct |
14 |
Correct |
32 ms |
14604 KB |
Output is correct |
15 |
Correct |
35 ms |
14704 KB |
Output is correct |
16 |
Correct |
32 ms |
14692 KB |
Output is correct |
17 |
Correct |
31 ms |
14464 KB |
Output is correct |
18 |
Correct |
27 ms |
14456 KB |
Output is correct |
19 |
Correct |
32 ms |
14416 KB |
Output is correct |
20 |
Correct |
30 ms |
14464 KB |
Output is correct |
21 |
Correct |
32 ms |
14380 KB |
Output is correct |
22 |
Correct |
31 ms |
14436 KB |
Output is correct |
23 |
Correct |
24 ms |
11380 KB |
Output is correct |
24 |
Correct |
25 ms |
11388 KB |
Output is correct |
25 |
Correct |
26 ms |
12116 KB |
Output is correct |
26 |
Correct |
25 ms |
11968 KB |
Output is correct |
27 |
Correct |
30 ms |
12872 KB |
Output is correct |
28 |
Correct |
27 ms |
12924 KB |
Output is correct |
29 |
Correct |
28 ms |
12924 KB |
Output is correct |
30 |
Correct |
28 ms |
12916 KB |
Output is correct |
31 |
Correct |
25 ms |
11308 KB |
Output is correct |
32 |
Correct |
25 ms |
11356 KB |
Output is correct |
33 |
Correct |
25 ms |
12048 KB |
Output is correct |
34 |
Correct |
25 ms |
11992 KB |
Output is correct |
35 |
Correct |
30 ms |
12792 KB |
Output is correct |
36 |
Correct |
31 ms |
13144 KB |
Output is correct |
37 |
Correct |
27 ms |
13104 KB |
Output is correct |
38 |
Correct |
27 ms |
13132 KB |
Output is correct |
39 |
Correct |
27 ms |
13172 KB |
Output is correct |
40 |
Correct |
28 ms |
13132 KB |
Output is correct |
41 |
Correct |
28 ms |
13876 KB |
Output is correct |
42 |
Correct |
31 ms |
14008 KB |
Output is correct |
43 |
Correct |
31 ms |
13976 KB |
Output is correct |
44 |
Correct |
30 ms |
13980 KB |
Output is correct |
45 |
Correct |
28 ms |
13908 KB |
Output is correct |
46 |
Correct |
33 ms |
14020 KB |
Output is correct |
47 |
Correct |
28 ms |
12884 KB |
Output is correct |
48 |
Correct |
27 ms |
12924 KB |
Output is correct |
49 |
Correct |
30 ms |
13016 KB |
Output is correct |
50 |
Correct |
27 ms |
13128 KB |
Output is correct |
51 |
Correct |
34 ms |
12404 KB |
Output is correct |
52 |
Correct |
27 ms |
12108 KB |
Output is correct |
53 |
Correct |
27 ms |
12108 KB |
Output is correct |
54 |
Correct |
26 ms |
12112 KB |
Output is correct |
55 |
Correct |
27 ms |
12108 KB |
Output is correct |
56 |
Correct |
26 ms |
12112 KB |
Output is correct |
57 |
Correct |
26 ms |
12116 KB |
Output is correct |
58 |
Correct |
24 ms |
12108 KB |
Output is correct |
59 |
Correct |
26 ms |
12200 KB |
Output is correct |
60 |
Correct |
25 ms |
12116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
11628 KB |
Output is correct |
2 |
Correct |
27 ms |
12828 KB |
Output is correct |
3 |
Correct |
1 ms |
1292 KB |
Output is correct |
4 |
Correct |
23 ms |
11376 KB |
Output is correct |
5 |
Correct |
38 ms |
14724 KB |
Output is correct |
6 |
Correct |
33 ms |
14716 KB |
Output is correct |
7 |
Correct |
28 ms |
13684 KB |
Output is correct |
8 |
Correct |
26 ms |
13660 KB |
Output is correct |
9 |
Correct |
35 ms |
14708 KB |
Output is correct |
10 |
Correct |
32 ms |
14712 KB |
Output is correct |
11 |
Correct |
31 ms |
14716 KB |
Output is correct |
12 |
Correct |
30 ms |
14708 KB |
Output is correct |
13 |
Correct |
34 ms |
14704 KB |
Output is correct |
14 |
Correct |
31 ms |
14720 KB |
Output is correct |
15 |
Correct |
32 ms |
14712 KB |
Output is correct |
16 |
Correct |
36 ms |
14644 KB |
Output is correct |
17 |
Correct |
28 ms |
14472 KB |
Output is correct |
18 |
Correct |
31 ms |
14372 KB |
Output is correct |
19 |
Correct |
31 ms |
14440 KB |
Output is correct |
20 |
Correct |
28 ms |
14284 KB |
Output is correct |
21 |
Correct |
30 ms |
14384 KB |
Output is correct |
22 |
Correct |
31 ms |
14388 KB |
Output is correct |
23 |
Correct |
25 ms |
11384 KB |
Output is correct |
24 |
Correct |
25 ms |
11488 KB |
Output is correct |
25 |
Correct |
27 ms |
12152 KB |
Output is correct |
26 |
Correct |
26 ms |
12156 KB |
Output is correct |
27 |
Correct |
27 ms |
12928 KB |
Output is correct |
28 |
Correct |
28 ms |
12892 KB |
Output is correct |
29 |
Correct |
40 ms |
12884 KB |
Output is correct |
30 |
Correct |
27 ms |
12928 KB |
Output is correct |
31 |
Correct |
27 ms |
11352 KB |
Output is correct |
32 |
Correct |
25 ms |
11396 KB |
Output is correct |
33 |
Correct |
25 ms |
12152 KB |
Output is correct |
34 |
Correct |
31 ms |
12060 KB |
Output is correct |
35 |
Correct |
28 ms |
12924 KB |
Output is correct |
36 |
Correct |
27 ms |
12740 KB |
Output is correct |
37 |
Correct |
30 ms |
12928 KB |
Output is correct |
38 |
Correct |
27 ms |
12924 KB |
Output is correct |
39 |
Correct |
27 ms |
12912 KB |
Output is correct |
40 |
Correct |
34 ms |
12908 KB |
Output is correct |
41 |
Correct |
30 ms |
13460 KB |
Output is correct |
42 |
Correct |
30 ms |
13420 KB |
Output is correct |
43 |
Correct |
30 ms |
13432 KB |
Output is correct |
44 |
Correct |
28 ms |
13400 KB |
Output is correct |
45 |
Correct |
28 ms |
13424 KB |
Output is correct |
46 |
Correct |
34 ms |
13428 KB |
Output is correct |
47 |
Correct |
28 ms |
12656 KB |
Output is correct |
48 |
Correct |
27 ms |
12676 KB |
Output is correct |
49 |
Correct |
33 ms |
12476 KB |
Output is correct |
50 |
Correct |
27 ms |
12672 KB |
Output is correct |
51 |
Correct |
27 ms |
11644 KB |
Output is correct |
52 |
Correct |
26 ms |
11632 KB |
Output is correct |
53 |
Correct |
27 ms |
11636 KB |
Output is correct |
54 |
Correct |
26 ms |
11636 KB |
Output is correct |
55 |
Correct |
25 ms |
11596 KB |
Output is correct |
56 |
Correct |
25 ms |
11608 KB |
Output is correct |
57 |
Correct |
25 ms |
11888 KB |
Output is correct |
58 |
Correct |
27 ms |
11636 KB |
Output is correct |
59 |
Correct |
28 ms |
11632 KB |
Output is correct |
60 |
Correct |
30 ms |
11632 KB |
Output is correct |