#include "Anthony.h"
#include "bits/stdc++.h"
using namespace std;
#define ff first
#define ss second
#define pb push_back
#define sz(x) (int)x.size()
const int N = 2e4+5;
namespace sol1{
vector<int> res;
vector<int> patt = {0, 1, 1, 0, 0, 1};
vector<pair<int, int>> edges[N];
void dfs(int u, int p = -1, int cur = 0, int in = 0){
for(auto x : edges[u]){
if(x.ff == p) continue;
if(sz(edges[u]) == 2){
res[x.ss] = patt[in];
dfs(x.ff, u, res[x.ss], (in + 1) % 6);
} else {
res[x.ss] = cur ^ 1;
if(cur) dfs(x.ff, u, cur ^ 1, 1);
else dfs(x.ff, u, cur ^ 1, 2);
}
}
}
vector<int> Mark1(int n, int m, int a, int b, vector<int> u, vector<int> v){
res.resize(m);
for(int i=0;i<m;i++){
int a = u[i] + 1, b = v[i] + 1;
edges[a].pb({b, i}), edges[b].pb({a, i});
res[i] = -1;
}
edges[1].pb({-1, -1});
dfs(1);
//~ for(int i=0;i<m;i++) cout<<res[i]<<" ";
//~ cout<<"\n";
return res;
}
}
namespace sol2{
vector<int> Mark2(int n, int m, int a, int b, vector<int> u, vector<int> v){
return {};
}
}
vector<int> Mark(int n, int m, int a, int b, vector<int> u, vector<int> v) {
if(a == 2) {
return sol1::Mark1(n, m, a, b, u, v);
} else {
return sol2::Mark2(n, m, a, b, u, v);
}
}
#include "Catherine.h"
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#define sz(x) (int)x.size()
vector<int> path;
int a;
void Init(int a, int b) { ::a = a; }
namespace sol1{
vector<int> ppat = {0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0};
int ok = 0, last = -1;
vector<int> path;
int Move(vector<int> y){
if(ok){
assert(~last);
if(y[0] + y[1] + 1 > 2) return last ^= 1;
if(y[0] == 0) return last = 1;
if(y[1] == 0) return last = 0;
assert(0);
}
if(y[0] + y[1] + (last != -1) > 2){
if(last != -1) y[last]++;
ok = 1;
if(y[0] == 1){
if(last == 0) return -1;
return last = 0;
} if(y[1] == 1){
if(last == 1) return -1;
return last = 1;
}
}
if(y[0] + y[1] + (last != -1) == 1){
ok = 1;
if(y[0] == 1) return last = 0;
if(y[1] == 1) return last = 1;
return -1;
}
if(last == -1){
if(y[0] == 2) { path.pb(0), path.pb(0); return last = 0; }
else if(y[1] == 2) { path.pb(1), path.pb(1); return last = 1; }
else { path.pb(0), path.pb(1); return last = 1; }
}
else {
if(y[0] == 1) last = 0, path.pb(0);
if(y[1] == 1) last = 1, path.pb(1);
if(sz(path) == 5){ ok = 1;
for(int i=0;i+5<=sz(ppat);i++){
int l = i, r = i + 5 - 1, okk = 1;
for(int j=l;j<=r;j++) okk &= (ppat[j] == path[j-i]);
if(okk) return -1;
} if(y[0]) return last = 0;
else return last = 1;
} else return last;
}
}
}
namespace sol2{
int Move(vector<int> y){
return 0;
}
}
int Move(vector<int> y) {
if(a == 2) return sol1::Move(y);
else return sol2::Move(y);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
1856 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
1856 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
2124 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
2124 KB |
Wrong Answer [1] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
1264 KB |
Output is correct |
2 |
Correct |
3 ms |
1004 KB |
Output is correct |
3 |
Correct |
2 ms |
1312 KB |
Output is correct |
4 |
Correct |
2 ms |
1264 KB |
Output is correct |
5 |
Correct |
3 ms |
1264 KB |
Output is correct |
6 |
Correct |
2 ms |
1328 KB |
Output is correct |
7 |
Correct |
2 ms |
1264 KB |
Output is correct |
8 |
Correct |
2 ms |
1276 KB |
Output is correct |
9 |
Correct |
2 ms |
1264 KB |
Output is correct |
10 |
Correct |
2 ms |
1264 KB |
Output is correct |
11 |
Correct |
2 ms |
1264 KB |
Output is correct |
12 |
Correct |
3 ms |
1260 KB |
Output is correct |
13 |
Correct |
2 ms |
1264 KB |
Output is correct |
14 |
Correct |
2 ms |
1264 KB |
Output is correct |
15 |
Correct |
2 ms |
1264 KB |
Output is correct |
16 |
Correct |
2 ms |
1264 KB |
Output is correct |
17 |
Correct |
2 ms |
1264 KB |
Output is correct |
18 |
Correct |
2 ms |
1276 KB |
Output is correct |
19 |
Correct |
2 ms |
1264 KB |
Output is correct |
20 |
Correct |
2 ms |
1260 KB |
Output is correct |
21 |
Correct |
2 ms |
1264 KB |
Output is correct |
22 |
Correct |
2 ms |
1276 KB |
Output is correct |
23 |
Correct |
2 ms |
1264 KB |
Output is correct |
24 |
Correct |
2 ms |
1264 KB |
Output is correct |
25 |
Correct |
2 ms |
1264 KB |
Output is correct |
26 |
Correct |
2 ms |
1272 KB |
Output is correct |
27 |
Correct |
2 ms |
1264 KB |
Output is correct |
28 |
Correct |
2 ms |
1264 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
42 ms |
11628 KB |
Output is correct |
2 |
Correct |
54 ms |
12920 KB |
Output is correct |
3 |
Correct |
2 ms |
1016 KB |
Output is correct |
4 |
Correct |
34 ms |
11512 KB |
Output is correct |
5 |
Correct |
54 ms |
14336 KB |
Output is correct |
6 |
Correct |
61 ms |
14368 KB |
Output is correct |
7 |
Correct |
45 ms |
13428 KB |
Output is correct |
8 |
Correct |
52 ms |
13592 KB |
Output is correct |
9 |
Correct |
54 ms |
14312 KB |
Output is correct |
10 |
Correct |
55 ms |
14320 KB |
Output is correct |
11 |
Correct |
54 ms |
14452 KB |
Output is correct |
12 |
Correct |
53 ms |
14384 KB |
Output is correct |
13 |
Correct |
55 ms |
14320 KB |
Output is correct |
14 |
Correct |
52 ms |
14480 KB |
Output is correct |
15 |
Correct |
60 ms |
14416 KB |
Output is correct |
16 |
Correct |
64 ms |
14276 KB |
Output is correct |
17 |
Correct |
56 ms |
13996 KB |
Output is correct |
18 |
Correct |
48 ms |
14296 KB |
Output is correct |
19 |
Correct |
50 ms |
14188 KB |
Output is correct |
20 |
Correct |
54 ms |
14140 KB |
Output is correct |
21 |
Correct |
59 ms |
14048 KB |
Output is correct |
22 |
Correct |
51 ms |
14064 KB |
Output is correct |
23 |
Correct |
40 ms |
11736 KB |
Output is correct |
24 |
Correct |
41 ms |
11608 KB |
Output is correct |
25 |
Correct |
44 ms |
12120 KB |
Output is correct |
26 |
Correct |
46 ms |
12136 KB |
Output is correct |
27 |
Correct |
59 ms |
12980 KB |
Output is correct |
28 |
Correct |
48 ms |
12916 KB |
Output is correct |
29 |
Correct |
46 ms |
13152 KB |
Output is correct |
30 |
Correct |
47 ms |
12908 KB |
Output is correct |
31 |
Correct |
40 ms |
11688 KB |
Output is correct |
32 |
Correct |
40 ms |
11616 KB |
Output is correct |
33 |
Correct |
41 ms |
12120 KB |
Output is correct |
34 |
Correct |
40 ms |
12040 KB |
Output is correct |
35 |
Correct |
45 ms |
12732 KB |
Output is correct |
36 |
Correct |
49 ms |
12868 KB |
Output is correct |
37 |
Correct |
48 ms |
12816 KB |
Output is correct |
38 |
Correct |
47 ms |
12784 KB |
Output is correct |
39 |
Correct |
48 ms |
12796 KB |
Output is correct |
40 |
Correct |
60 ms |
12852 KB |
Output is correct |
41 |
Correct |
54 ms |
13508 KB |
Output is correct |
42 |
Correct |
47 ms |
13412 KB |
Output is correct |
43 |
Correct |
48 ms |
13524 KB |
Output is correct |
44 |
Correct |
53 ms |
13592 KB |
Output is correct |
45 |
Correct |
51 ms |
13512 KB |
Output is correct |
46 |
Correct |
52 ms |
13604 KB |
Output is correct |
47 |
Correct |
46 ms |
12664 KB |
Output is correct |
48 |
Correct |
46 ms |
12592 KB |
Output is correct |
49 |
Correct |
43 ms |
12588 KB |
Output is correct |
50 |
Correct |
45 ms |
12796 KB |
Output is correct |
51 |
Correct |
40 ms |
11904 KB |
Output is correct |
52 |
Correct |
40 ms |
11892 KB |
Output is correct |
53 |
Correct |
40 ms |
11892 KB |
Output is correct |
54 |
Correct |
46 ms |
11820 KB |
Output is correct |
55 |
Correct |
40 ms |
11916 KB |
Output is correct |
56 |
Correct |
41 ms |
11860 KB |
Output is correct |
57 |
Correct |
40 ms |
11664 KB |
Output is correct |
58 |
Correct |
47 ms |
11620 KB |
Output is correct |
59 |
Correct |
43 ms |
12048 KB |
Output is correct |
60 |
Correct |
40 ms |
11828 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
11616 KB |
Output is correct |
2 |
Correct |
50 ms |
12788 KB |
Output is correct |
3 |
Correct |
2 ms |
1004 KB |
Output is correct |
4 |
Correct |
46 ms |
11360 KB |
Output is correct |
5 |
Correct |
57 ms |
14372 KB |
Output is correct |
6 |
Correct |
52 ms |
14300 KB |
Output is correct |
7 |
Correct |
43 ms |
13388 KB |
Output is correct |
8 |
Correct |
44 ms |
13604 KB |
Output is correct |
9 |
Correct |
57 ms |
14376 KB |
Output is correct |
10 |
Correct |
69 ms |
14268 KB |
Output is correct |
11 |
Correct |
52 ms |
14324 KB |
Output is correct |
12 |
Correct |
54 ms |
14404 KB |
Output is correct |
13 |
Correct |
68 ms |
14360 KB |
Output is correct |
14 |
Correct |
62 ms |
14416 KB |
Output is correct |
15 |
Correct |
53 ms |
14532 KB |
Output is correct |
16 |
Correct |
53 ms |
14316 KB |
Output is correct |
17 |
Correct |
57 ms |
14132 KB |
Output is correct |
18 |
Correct |
53 ms |
14180 KB |
Output is correct |
19 |
Correct |
51 ms |
13956 KB |
Output is correct |
20 |
Correct |
52 ms |
14036 KB |
Output is correct |
21 |
Correct |
50 ms |
14044 KB |
Output is correct |
22 |
Correct |
49 ms |
14124 KB |
Output is correct |
23 |
Correct |
40 ms |
11712 KB |
Output is correct |
24 |
Correct |
46 ms |
11644 KB |
Output is correct |
25 |
Correct |
43 ms |
12132 KB |
Output is correct |
26 |
Correct |
50 ms |
12056 KB |
Output is correct |
27 |
Correct |
46 ms |
12916 KB |
Output is correct |
28 |
Correct |
48 ms |
12976 KB |
Output is correct |
29 |
Correct |
47 ms |
13032 KB |
Output is correct |
30 |
Correct |
48 ms |
12972 KB |
Output is correct |
31 |
Correct |
40 ms |
11684 KB |
Output is correct |
32 |
Correct |
48 ms |
11676 KB |
Output is correct |
33 |
Correct |
41 ms |
12152 KB |
Output is correct |
34 |
Correct |
41 ms |
12144 KB |
Output is correct |
35 |
Correct |
50 ms |
12744 KB |
Output is correct |
36 |
Correct |
46 ms |
12864 KB |
Output is correct |
37 |
Correct |
48 ms |
12784 KB |
Output is correct |
38 |
Correct |
50 ms |
12848 KB |
Output is correct |
39 |
Correct |
49 ms |
12920 KB |
Output is correct |
40 |
Correct |
47 ms |
12784 KB |
Output is correct |
41 |
Correct |
50 ms |
13460 KB |
Output is correct |
42 |
Correct |
50 ms |
13616 KB |
Output is correct |
43 |
Correct |
55 ms |
13420 KB |
Output is correct |
44 |
Correct |
52 ms |
13508 KB |
Output is correct |
45 |
Correct |
49 ms |
13480 KB |
Output is correct |
46 |
Correct |
53 ms |
13568 KB |
Output is correct |
47 |
Correct |
50 ms |
12612 KB |
Output is correct |
48 |
Correct |
45 ms |
12580 KB |
Output is correct |
49 |
Correct |
43 ms |
12536 KB |
Output is correct |
50 |
Correct |
45 ms |
12764 KB |
Output is correct |
51 |
Correct |
44 ms |
11928 KB |
Output is correct |
52 |
Correct |
48 ms |
11864 KB |
Output is correct |
53 |
Correct |
40 ms |
11868 KB |
Output is correct |
54 |
Correct |
40 ms |
11904 KB |
Output is correct |
55 |
Correct |
40 ms |
11904 KB |
Output is correct |
56 |
Correct |
41 ms |
11840 KB |
Output is correct |
57 |
Correct |
43 ms |
11736 KB |
Output is correct |
58 |
Correct |
40 ms |
11708 KB |
Output is correct |
59 |
Correct |
40 ms |
11876 KB |
Output is correct |
60 |
Correct |
40 ms |
11884 KB |
Output is correct |