#include "Anthony.h"
#include <bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(iter(a), greater<>())
#define eb emplace_back
#define printv(a, b) { \
for(auto pv : a) b << pv << " "; \
b << "\n"; \
}
using namespace std;
using pii = pair<int, int>;
namespace {
vector<int> magic;
vector<vector<pii>> g;
vector<int> ans;
} // namespace
void dfs(int now, int p, int top, int len){
int cnt = 0;
for(pii i : g[now]){
if(i.F == p) continue;
cnt++;
}
int nxt = !top;
if(cnt == 1){
if(len == -1){
if(top == 0) len = 0;
else len = 1;
}
len++;
//cerr << "two " << now << " " << len << "\n";
nxt = magic[len % 6];
}
else len = -1;
for(pii i : g[now]){
if(i.F == p) continue;
ans[i.S] = nxt;
dfs(i.F, now, nxt, len);
}
}
vector<int> Mark(int n, int m, int A, int B,
vector<int> U, vector<int> V) {
magic = {0, 1, 0, 0, 1, 1};
ans.resize(m);
g.resize(n);
for(int i = 0; i < m; i++){
int u = U[i], v = V[i];
g[u].eb(mp(v, i));
g[v].eb(mp(u, i));
}
dfs(0, 0, 1, -1);
//printv(ans, cerr);
return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(iter(a), greater<>())
#define eb emplace_back
#define printv(a, b) { \
for(auto pv : a) b << pv << " "; \
b << "\n"; \
}
using namespace std;
namespace {
int A, B;
int lst = -1;
vector<int> magic;
deque<int> tmp;
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
magic = {0, 1, 0, 0, 1, 1};
}
bool check(){
while(tmp.size() > 5) tmp.pop_front();
if(tmp.size() < 5) return false;
for(int i = 0; i < 6; i++){
bool ok = true;
for(int j = 0; j < 5; j++){
if(tmp[j] != magic[(i + j) % 6]) ok = false;
}
if(ok) return true;
}
return false;
}
int Move(vector<int> y) {
if(lst != -1) y[lst]++;
int deg = 0;
for(int i : y) deg += i;
if(deg >= 3){
int r;
for(int i = 0; i < 2; i++){
if(y[i] != 1) continue;
if(i == lst) r = -1;
else r = lst = i;
}
tmp.clear();
tmp.eb(lst);
//cerr << "test " << r << "\n";
return r;
}
//cerr << "check ";
//printv(tmp, cerr);
if(check()){
tmp.clear();
tmp.eb(lst);
return -1;
}
int nxt = -1;
if(lst != -1) y[lst]--;
for(int i = 0; i < 2; i++){
if(y[i]){
nxt = i;
//break;
}
}
lst = nxt;
tmp.eb(nxt);
//cerr << nxt << "\n";
return nxt;
}
Compilation message
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:54:13: warning: 'r' may be used uninitialized in this function [-Wmaybe-uninitialized]
54 | int r;
| ^
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
15828 KB |
Output is correct |
2 |
Correct |
0 ms |
492 KB |
Output is correct |
3 |
Correct |
28 ms |
14764 KB |
Output is correct |
4 |
Correct |
49 ms |
17196 KB |
Output is correct |
5 |
Correct |
56 ms |
17312 KB |
Output is correct |
6 |
Correct |
38 ms |
15268 KB |
Output is correct |
7 |
Incorrect |
40 ms |
15404 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
38 ms |
15828 KB |
Output is correct |
2 |
Correct |
0 ms |
492 KB |
Output is correct |
3 |
Correct |
28 ms |
14764 KB |
Output is correct |
4 |
Correct |
49 ms |
17196 KB |
Output is correct |
5 |
Correct |
56 ms |
17312 KB |
Output is correct |
6 |
Correct |
38 ms |
15268 KB |
Output is correct |
7 |
Incorrect |
40 ms |
15404 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
46 ms |
13396 KB |
Output is correct |
2 |
Correct |
0 ms |
492 KB |
Output is correct |
3 |
Correct |
27 ms |
12632 KB |
Output is correct |
4 |
Correct |
57 ms |
14996 KB |
Output is correct |
5 |
Correct |
43 ms |
15208 KB |
Output is correct |
6 |
Correct |
38 ms |
13064 KB |
Output is correct |
7 |
Incorrect |
31 ms |
13180 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
46 ms |
13396 KB |
Output is correct |
2 |
Correct |
0 ms |
492 KB |
Output is correct |
3 |
Correct |
27 ms |
12632 KB |
Output is correct |
4 |
Correct |
57 ms |
14996 KB |
Output is correct |
5 |
Correct |
43 ms |
15208 KB |
Output is correct |
6 |
Correct |
38 ms |
13064 KB |
Output is correct |
7 |
Incorrect |
31 ms |
13180 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
880 KB |
Output is correct |
2 |
Correct |
0 ms |
492 KB |
Output is correct |
3 |
Correct |
1 ms |
880 KB |
Output is correct |
4 |
Correct |
2 ms |
872 KB |
Output is correct |
5 |
Correct |
2 ms |
948 KB |
Output is correct |
6 |
Correct |
2 ms |
952 KB |
Output is correct |
7 |
Correct |
2 ms |
872 KB |
Output is correct |
8 |
Correct |
1 ms |
872 KB |
Output is correct |
9 |
Correct |
1 ms |
872 KB |
Output is correct |
10 |
Correct |
2 ms |
872 KB |
Output is correct |
11 |
Correct |
1 ms |
880 KB |
Output is correct |
12 |
Correct |
2 ms |
872 KB |
Output is correct |
13 |
Correct |
2 ms |
880 KB |
Output is correct |
14 |
Correct |
2 ms |
872 KB |
Output is correct |
15 |
Correct |
2 ms |
872 KB |
Output is correct |
16 |
Correct |
2 ms |
880 KB |
Output is correct |
17 |
Correct |
2 ms |
872 KB |
Output is correct |
18 |
Correct |
2 ms |
872 KB |
Output is correct |
19 |
Correct |
3 ms |
872 KB |
Output is correct |
20 |
Correct |
2 ms |
872 KB |
Output is correct |
21 |
Correct |
2 ms |
872 KB |
Output is correct |
22 |
Correct |
2 ms |
868 KB |
Output is correct |
23 |
Correct |
2 ms |
880 KB |
Output is correct |
24 |
Correct |
2 ms |
880 KB |
Output is correct |
25 |
Correct |
1 ms |
880 KB |
Output is correct |
26 |
Correct |
2 ms |
872 KB |
Output is correct |
27 |
Correct |
2 ms |
880 KB |
Output is correct |
28 |
Correct |
2 ms |
872 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
30 ms |
11180 KB |
Output is correct |
2 |
Correct |
34 ms |
12264 KB |
Output is correct |
3 |
Correct |
0 ms |
484 KB |
Output is correct |
4 |
Correct |
27 ms |
10984 KB |
Output is correct |
5 |
Correct |
48 ms |
13524 KB |
Output is correct |
6 |
Correct |
45 ms |
13460 KB |
Output is correct |
7 |
Correct |
40 ms |
12616 KB |
Output is correct |
8 |
Correct |
35 ms |
12640 KB |
Output is correct |
9 |
Correct |
43 ms |
13408 KB |
Output is correct |
10 |
Correct |
40 ms |
13424 KB |
Output is correct |
11 |
Correct |
41 ms |
13500 KB |
Output is correct |
12 |
Correct |
52 ms |
13496 KB |
Output is correct |
13 |
Correct |
41 ms |
13596 KB |
Output is correct |
14 |
Correct |
39 ms |
13460 KB |
Output is correct |
15 |
Correct |
41 ms |
13436 KB |
Output is correct |
16 |
Correct |
43 ms |
13492 KB |
Output is correct |
17 |
Correct |
40 ms |
13168 KB |
Output is correct |
18 |
Correct |
49 ms |
13208 KB |
Output is correct |
19 |
Correct |
50 ms |
13144 KB |
Output is correct |
20 |
Correct |
49 ms |
13228 KB |
Output is correct |
21 |
Correct |
45 ms |
13244 KB |
Output is correct |
22 |
Correct |
41 ms |
13220 KB |
Output is correct |
23 |
Correct |
44 ms |
11080 KB |
Output is correct |
24 |
Correct |
34 ms |
11236 KB |
Output is correct |
25 |
Correct |
33 ms |
11640 KB |
Output is correct |
26 |
Correct |
32 ms |
11556 KB |
Output is correct |
27 |
Correct |
37 ms |
12384 KB |
Output is correct |
28 |
Correct |
64 ms |
12268 KB |
Output is correct |
29 |
Correct |
49 ms |
12248 KB |
Output is correct |
30 |
Correct |
41 ms |
12356 KB |
Output is correct |
31 |
Correct |
30 ms |
11216 KB |
Output is correct |
32 |
Correct |
30 ms |
11232 KB |
Output is correct |
33 |
Correct |
39 ms |
11528 KB |
Output is correct |
34 |
Correct |
31 ms |
11616 KB |
Output is correct |
35 |
Correct |
36 ms |
12240 KB |
Output is correct |
36 |
Correct |
37 ms |
12284 KB |
Output is correct |
37 |
Correct |
40 ms |
12332 KB |
Output is correct |
38 |
Correct |
39 ms |
12220 KB |
Output is correct |
39 |
Correct |
46 ms |
12168 KB |
Output is correct |
40 |
Correct |
38 ms |
12216 KB |
Output is correct |
41 |
Correct |
45 ms |
12768 KB |
Output is correct |
42 |
Correct |
39 ms |
12820 KB |
Output is correct |
43 |
Correct |
40 ms |
12796 KB |
Output is correct |
44 |
Correct |
49 ms |
12864 KB |
Output is correct |
45 |
Correct |
41 ms |
12808 KB |
Output is correct |
46 |
Correct |
47 ms |
12888 KB |
Output is correct |
47 |
Correct |
42 ms |
12024 KB |
Output is correct |
48 |
Correct |
43 ms |
12056 KB |
Output is correct |
49 |
Correct |
37 ms |
11948 KB |
Output is correct |
50 |
Correct |
38 ms |
12148 KB |
Output is correct |
51 |
Correct |
34 ms |
11292 KB |
Output is correct |
52 |
Correct |
34 ms |
11428 KB |
Output is correct |
53 |
Correct |
39 ms |
11400 KB |
Output is correct |
54 |
Correct |
40 ms |
11352 KB |
Output is correct |
55 |
Correct |
31 ms |
11424 KB |
Output is correct |
56 |
Correct |
36 ms |
11464 KB |
Output is correct |
57 |
Correct |
34 ms |
11188 KB |
Output is correct |
58 |
Correct |
34 ms |
11260 KB |
Output is correct |
59 |
Correct |
33 ms |
11380 KB |
Output is correct |
60 |
Correct |
31 ms |
11504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
31 ms |
11236 KB |
Output is correct |
2 |
Correct |
41 ms |
11992 KB |
Output is correct |
3 |
Correct |
0 ms |
444 KB |
Output is correct |
4 |
Correct |
34 ms |
10968 KB |
Output is correct |
5 |
Correct |
48 ms |
13584 KB |
Output is correct |
6 |
Correct |
49 ms |
13512 KB |
Output is correct |
7 |
Incorrect |
34 ms |
12564 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |