#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);
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 != -1) d++;
if(flag){
if(d>=3) {
return prv = 1 - prv;
}
return prv = y[1];
}
if(d==1){
flag=true;
if(prv != -1) return -1;
return prv = y[1];
}
if(d>=3){
if(prv != -1) y[prv]++;
flag=true;
int tmp = (y[1] == 1);
if(tmp==prv) return -1;
return prv = tmp;
}
if(cnt<=3){
prv = (y[1] > 0);
if(cnt==1) mask = (y[1]-prv << 1);
mask <<= 1;
mask |= prv;
return prv;
}
if(cnt==4){
flag=true;
mask <<= 1;
mask |= y[1];
if(mask==25||mask==18||mask==5||mask==11||mask==22||mask==12) {
return prv = y[1];
}
return -1;
}
}
Compilation message
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:54:30: warning: suggest parentheses around '-' inside '<<' [-Wparentheses]
if(cnt==1) mask = (y[1]-prv << 1);
Catherine.cpp:68:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
16152 KB |
Output is correct |
2 |
Correct |
1 ms |
1536 KB |
Output is correct |
3 |
Correct |
40 ms |
14968 KB |
Output is correct |
4 |
Correct |
63 ms |
17544 KB |
Output is correct |
5 |
Incorrect |
63 ms |
17396 KB |
Wrong Answer [6] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
53 ms |
16152 KB |
Output is correct |
2 |
Correct |
1 ms |
1536 KB |
Output is correct |
3 |
Correct |
40 ms |
14968 KB |
Output is correct |
4 |
Correct |
63 ms |
17544 KB |
Output is correct |
5 |
Incorrect |
63 ms |
17396 KB |
Wrong Answer [6] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
46 ms |
13692 KB |
Output is correct |
2 |
Correct |
1 ms |
1536 KB |
Output is correct |
3 |
Correct |
40 ms |
12852 KB |
Output is correct |
4 |
Correct |
59 ms |
15228 KB |
Output is correct |
5 |
Incorrect |
60 ms |
15220 KB |
Wrong Answer [6] |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
46 ms |
13692 KB |
Output is correct |
2 |
Correct |
1 ms |
1536 KB |
Output is correct |
3 |
Correct |
40 ms |
12852 KB |
Output is correct |
4 |
Correct |
59 ms |
15228 KB |
Output is correct |
5 |
Incorrect |
60 ms |
15220 KB |
Wrong Answer [6] |
6 |
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 |
1536 KB |
Output is correct |
17 |
Correct |
3 ms |
1792 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 |
1536 KB |
Output is correct |
22 |
Correct |
3 ms |
1712 KB |
Output is correct |
23 |
Correct |
2 ms |
1536 KB |
Output is correct |
24 |
Incorrect |
3 ms |
1792 KB |
Wrong Answer [5] |
25 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
41 ms |
11452 KB |
Output is correct |
2 |
Correct |
48 ms |
12440 KB |
Output is correct |
3 |
Correct |
1 ms |
1536 KB |
Output is correct |
4 |
Correct |
37 ms |
11128 KB |
Output is correct |
5 |
Correct |
54 ms |
13836 KB |
Output is correct |
6 |
Incorrect |
42 ms |
12668 KB |
Wrong Answer [5] |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
45 ms |
11600 KB |
Output is correct |
2 |
Correct |
48 ms |
12300 KB |
Output is correct |
3 |
Correct |
1 ms |
1536 KB |
Output is correct |
4 |
Correct |
36 ms |
11328 KB |
Output is correct |
5 |
Correct |
54 ms |
13736 KB |
Output is correct |
6 |
Correct |
58 ms |
13836 KB |
Output is correct |
7 |
Correct |
45 ms |
12968 KB |
Output is correct |
8 |
Correct |
50 ms |
12928 KB |
Output is correct |
9 |
Correct |
63 ms |
13840 KB |
Output is correct |
10 |
Correct |
59 ms |
13684 KB |
Output is correct |
11 |
Correct |
64 ms |
13700 KB |
Output is correct |
12 |
Correct |
62 ms |
13812 KB |
Output is correct |
13 |
Correct |
56 ms |
13692 KB |
Output is correct |
14 |
Correct |
59 ms |
13728 KB |
Output is correct |
15 |
Correct |
59 ms |
13840 KB |
Output is correct |
16 |
Correct |
65 ms |
13852 KB |
Output is correct |
17 |
Correct |
57 ms |
13564 KB |
Output is correct |
18 |
Correct |
57 ms |
13452 KB |
Output is correct |
19 |
Correct |
58 ms |
13460 KB |
Output is correct |
20 |
Correct |
57 ms |
13452 KB |
Output is correct |
21 |
Correct |
54 ms |
13428 KB |
Output is correct |
22 |
Correct |
56 ms |
13676 KB |
Output is correct |
23 |
Correct |
43 ms |
11528 KB |
Output is correct |
24 |
Incorrect |
40 ms |
11516 KB |
Wrong Answer [5] |
25 |
Halted |
0 ms |
0 KB |
- |