#include "Anthony.h"
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;
static vector<pii> g[20010];
static vector<int> ret;
static int tb[6] = {0, 1, 0, 0, 1, 1};
static void dfs(int x, int p, int k) {
int t = 1 - tb[k];
if(x != 0 && g[x].size() == 2) t = (k + 1) % 6;
for(auto i : g[x]) {
if(i.fi == p) continue;
ret[i.se] = tb[t];
dfs(i.fi, x, t);
}
}
std::vector<int> Mark(int N, int M, int A, int B, std::vector<int> U, std::vector<int> V) {
for(int i=0; i<M; i++)
g[U[i]].eb(V[i], i), g[V[i]].eb(U[i], i);
ret.resize(M, 0);
dfs(0, 0, 0);
/*for(auto i : ret) {
cout << i;
}
cout << endl;*/
return ret;
}
#include "Catherine.h"
#include<bits/stdc++.h>
using namespace std;
#define fast ios::sync_with_stdio(false); cin.tie(0);
#define fi first
#define se second
#define all(v) (v).begin(), (v).end()
#define em emplace
#define eb emplace_back
#define mp make_pair
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
const ll INF = 1e18;
const int inf = 1e9;
static int cnt, mask, prv = -1;
static bool flag = false;
static int a, b;
void Init(int A, int B) {
a = A;
b = B;
}
int Move(std::vector<int> y) {
cnt++;
int d=y[0]+y[1];
if(prv>=0) d++;
if(flag){
if(d>=3) {
prv=1-prv;
return prv;
}
if(y[0]) prv=0;
else prv=1;
return prv;
}
if(d==1){
flag=true;
if(cnt>1) return -1;
if(y[0])prv=0;
else prv=1;
return prv;
}
if(d>=3){
if(cnt>1) y[prv]++;
flag=true;
int tmp;
if(y[0]==1) tmp=0;
else tmp=1;
if(tmp==prv&&cnt>1)return -1;
prv=tmp;
return tmp;
}
if(cnt<=3){
if(y[0])prv=0;
else prv=1;
if(cnt==1)mask*=2, mask+=y[1]-prv;
mask*=2, mask+=prv;
return prv;
}
if(cnt==4){
flag=true;
int opp;
if(y[0])opp=0;
else opp=1;
mask*=2, mask+=opp;
if(mask==25||mask==18||mask==5||mask==11||mask==22||mask==12){
prv=opp;
return prv;
}
return -1;
}
}
Compilation message
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:77:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
53 ms |
16116 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
53 ms |
16116 KB |
Wrong Answer [6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
47 ms |
13692 KB |
Output is correct |
2 |
Correct |
2 ms |
1536 KB |
Output is correct |
3 |
Correct |
40 ms |
12796 KB |
Output is correct |
4 |
Correct |
65 ms |
15376 KB |
Output is correct |
5 |
Correct |
64 ms |
15368 KB |
Output is correct |
6 |
Correct |
48 ms |
13780 KB |
Output is correct |
7 |
Incorrect |
51 ms |
13772 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
47 ms |
13692 KB |
Output is correct |
2 |
Correct |
2 ms |
1536 KB |
Output is correct |
3 |
Correct |
40 ms |
12796 KB |
Output is correct |
4 |
Correct |
65 ms |
15376 KB |
Output is correct |
5 |
Correct |
64 ms |
15368 KB |
Output is correct |
6 |
Correct |
48 ms |
13780 KB |
Output is correct |
7 |
Incorrect |
51 ms |
13772 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
1536 KB |
Output is correct |
2 |
Correct |
1 ms |
1536 KB |
Output is correct |
3 |
Correct |
2 ms |
1536 KB |
Output is correct |
4 |
Correct |
2 ms |
1792 KB |
Output is correct |
5 |
Correct |
2 ms |
1792 KB |
Output is correct |
6 |
Correct |
2 ms |
1792 KB |
Output is correct |
7 |
Correct |
2 ms |
1792 KB |
Output is correct |
8 |
Correct |
2 ms |
1792 KB |
Output is correct |
9 |
Correct |
2 ms |
1792 KB |
Output is correct |
10 |
Correct |
2 ms |
1792 KB |
Output is correct |
11 |
Correct |
2 ms |
1792 KB |
Output is correct |
12 |
Correct |
2 ms |
1536 KB |
Output is correct |
13 |
Correct |
2 ms |
1536 KB |
Output is correct |
14 |
Correct |
2 ms |
1792 KB |
Output is correct |
15 |
Correct |
2 ms |
1792 KB |
Output is correct |
16 |
Correct |
2 ms |
1792 KB |
Output is correct |
17 |
Correct |
2 ms |
1536 KB |
Output is correct |
18 |
Correct |
2 ms |
1536 KB |
Output is correct |
19 |
Correct |
2 ms |
1536 KB |
Output is correct |
20 |
Correct |
2 ms |
1536 KB |
Output is correct |
21 |
Correct |
2 ms |
1792 KB |
Output is correct |
22 |
Correct |
2 ms |
1536 KB |
Output is correct |
23 |
Correct |
2 ms |
1536 KB |
Output is correct |
24 |
Correct |
2 ms |
1792 KB |
Output is correct |
25 |
Correct |
2 ms |
1536 KB |
Output is correct |
26 |
Correct |
2 ms |
1536 KB |
Output is correct |
27 |
Correct |
3 ms |
1792 KB |
Output is correct |
28 |
Correct |
2 ms |
1536 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
43 ms |
11388 KB |
Output is correct |
2 |
Correct |
51 ms |
12576 KB |
Output is correct |
3 |
Correct |
1 ms |
1536 KB |
Output is correct |
4 |
Correct |
36 ms |
11416 KB |
Output is correct |
5 |
Correct |
54 ms |
13720 KB |
Output is correct |
6 |
Correct |
55 ms |
13848 KB |
Output is correct |
7 |
Correct |
48 ms |
13128 KB |
Output is correct |
8 |
Correct |
46 ms |
12828 KB |
Output is correct |
9 |
Correct |
59 ms |
13800 KB |
Output is correct |
10 |
Correct |
57 ms |
13692 KB |
Output is correct |
11 |
Correct |
63 ms |
13668 KB |
Output is correct |
12 |
Correct |
70 ms |
13716 KB |
Output is correct |
13 |
Correct |
69 ms |
13692 KB |
Output is correct |
14 |
Correct |
63 ms |
13832 KB |
Output is correct |
15 |
Correct |
60 ms |
13960 KB |
Output is correct |
16 |
Correct |
59 ms |
13692 KB |
Output is correct |
17 |
Correct |
61 ms |
13468 KB |
Output is correct |
18 |
Correct |
59 ms |
13300 KB |
Output is correct |
19 |
Correct |
59 ms |
13460 KB |
Output is correct |
20 |
Correct |
53 ms |
13420 KB |
Output is correct |
21 |
Correct |
56 ms |
13428 KB |
Output is correct |
22 |
Correct |
60 ms |
13448 KB |
Output is correct |
23 |
Correct |
50 ms |
11516 KB |
Output is correct |
24 |
Correct |
52 ms |
11616 KB |
Output is correct |
25 |
Correct |
51 ms |
11784 KB |
Output is correct |
26 |
Correct |
48 ms |
11772 KB |
Output is correct |
27 |
Correct |
53 ms |
12704 KB |
Output is correct |
28 |
Correct |
52 ms |
12696 KB |
Output is correct |
29 |
Correct |
51 ms |
12696 KB |
Output is correct |
30 |
Correct |
51 ms |
12692 KB |
Output is correct |
31 |
Correct |
43 ms |
11388 KB |
Output is correct |
32 |
Correct |
44 ms |
11624 KB |
Output is correct |
33 |
Correct |
45 ms |
11644 KB |
Output is correct |
34 |
Correct |
46 ms |
11772 KB |
Output is correct |
35 |
Correct |
49 ms |
12648 KB |
Output is correct |
36 |
Correct |
49 ms |
12760 KB |
Output is correct |
37 |
Correct |
52 ms |
12620 KB |
Output is correct |
38 |
Correct |
50 ms |
12748 KB |
Output is correct |
39 |
Correct |
50 ms |
12572 KB |
Output is correct |
40 |
Correct |
53 ms |
12412 KB |
Output is correct |
41 |
Correct |
54 ms |
13116 KB |
Output is correct |
42 |
Correct |
54 ms |
13136 KB |
Output is correct |
43 |
Correct |
55 ms |
13124 KB |
Output is correct |
44 |
Correct |
51 ms |
13172 KB |
Output is correct |
45 |
Correct |
54 ms |
13256 KB |
Output is correct |
46 |
Correct |
58 ms |
13008 KB |
Output is correct |
47 |
Correct |
52 ms |
12280 KB |
Output is correct |
48 |
Correct |
49 ms |
12304 KB |
Output is correct |
49 |
Correct |
47 ms |
12440 KB |
Output is correct |
50 |
Correct |
50 ms |
12412 KB |
Output is correct |
51 |
Correct |
47 ms |
11700 KB |
Output is correct |
52 |
Correct |
45 ms |
11756 KB |
Output is correct |
53 |
Correct |
47 ms |
11708 KB |
Output is correct |
54 |
Correct |
46 ms |
11524 KB |
Output is correct |
55 |
Correct |
49 ms |
11720 KB |
Output is correct |
56 |
Correct |
45 ms |
11636 KB |
Output is correct |
57 |
Correct |
44 ms |
11536 KB |
Output is correct |
58 |
Correct |
49 ms |
11648 KB |
Output is correct |
59 |
Correct |
50 ms |
11820 KB |
Output is correct |
60 |
Correct |
53 ms |
11620 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
52 ms |
11388 KB |
Output is correct |
2 |
Correct |
48 ms |
12284 KB |
Output is correct |
3 |
Correct |
1 ms |
1536 KB |
Output is correct |
4 |
Correct |
43 ms |
11128 KB |
Output is correct |
5 |
Correct |
56 ms |
13708 KB |
Output is correct |
6 |
Correct |
55 ms |
13716 KB |
Output is correct |
7 |
Correct |
46 ms |
12832 KB |
Output is correct |
8 |
Correct |
45 ms |
12944 KB |
Output is correct |
9 |
Correct |
57 ms |
13832 KB |
Output is correct |
10 |
Correct |
58 ms |
13820 KB |
Output is correct |
11 |
Correct |
75 ms |
13712 KB |
Output is correct |
12 |
Correct |
55 ms |
13832 KB |
Output is correct |
13 |
Correct |
55 ms |
13988 KB |
Output is correct |
14 |
Correct |
57 ms |
13704 KB |
Output is correct |
15 |
Correct |
59 ms |
13684 KB |
Output is correct |
16 |
Correct |
60 ms |
13692 KB |
Output is correct |
17 |
Correct |
55 ms |
13452 KB |
Output is correct |
18 |
Correct |
53 ms |
13464 KB |
Output is correct |
19 |
Correct |
53 ms |
13428 KB |
Output is correct |
20 |
Correct |
56 ms |
13420 KB |
Output is correct |
21 |
Correct |
53 ms |
13444 KB |
Output is correct |
22 |
Correct |
54 ms |
13456 KB |
Output is correct |
23 |
Correct |
43 ms |
11612 KB |
Output is correct |
24 |
Correct |
45 ms |
11616 KB |
Output is correct |
25 |
Correct |
48 ms |
11796 KB |
Output is correct |
26 |
Correct |
45 ms |
11792 KB |
Output is correct |
27 |
Correct |
56 ms |
12708 KB |
Output is correct |
28 |
Correct |
55 ms |
12944 KB |
Output is correct |
29 |
Correct |
50 ms |
12620 KB |
Output is correct |
30 |
Correct |
53 ms |
12540 KB |
Output is correct |
31 |
Correct |
44 ms |
11624 KB |
Output is correct |
32 |
Correct |
43 ms |
11624 KB |
Output is correct |
33 |
Correct |
51 ms |
11792 KB |
Output is correct |
34 |
Correct |
47 ms |
11804 KB |
Output is correct |
35 |
Correct |
58 ms |
12628 KB |
Output is correct |
36 |
Correct |
57 ms |
12516 KB |
Output is correct |
37 |
Correct |
52 ms |
12636 KB |
Output is correct |
38 |
Correct |
53 ms |
12592 KB |
Output is correct |
39 |
Correct |
53 ms |
12520 KB |
Output is correct |
40 |
Correct |
50 ms |
12884 KB |
Output is correct |
41 |
Correct |
51 ms |
12916 KB |
Output is correct |
42 |
Correct |
53 ms |
13120 KB |
Output is correct |
43 |
Correct |
53 ms |
13052 KB |
Output is correct |
44 |
Correct |
58 ms |
13044 KB |
Output is correct |
45 |
Correct |
53 ms |
13132 KB |
Output is correct |
46 |
Correct |
55 ms |
13256 KB |
Output is correct |
47 |
Correct |
50 ms |
12412 KB |
Output is correct |
48 |
Correct |
56 ms |
12412 KB |
Output is correct |
49 |
Correct |
51 ms |
12192 KB |
Output is correct |
50 |
Correct |
49 ms |
12608 KB |
Output is correct |
51 |
Correct |
51 ms |
11676 KB |
Output is correct |
52 |
Correct |
45 ms |
11696 KB |
Output is correct |
53 |
Correct |
46 ms |
11644 KB |
Output is correct |
54 |
Correct |
44 ms |
11644 KB |
Output is correct |
55 |
Correct |
44 ms |
11644 KB |
Output is correct |
56 |
Correct |
44 ms |
11516 KB |
Output is correct |
57 |
Correct |
52 ms |
11508 KB |
Output is correct |
58 |
Correct |
49 ms |
11688 KB |
Output is correct |
59 |
Correct |
49 ms |
11644 KB |
Output is correct |
60 |
Correct |
45 ms |
11644 KB |
Output is correct |