#include "Anthony.h"
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define pii pair < int, int >
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
namespace {
const int N = 2e4+10, M = 2e4+10, A = 4;
vector < pii > edges[N];
vector < int > oznake;
int dis[N];
int zap[N];
queue < int > q;
int pat[6] = {0, 1, 0, 0, 1, 1};
vector < int > mark( int n, int m, int a, int b, vector < int > t1, vector < int > t2 ) {
for(int i = 0; i < m; i++) {
edges[t1[i]].pb(mp(t2[i], i));
edges[t2[i]].pb(mp(t1[i], i));
oznake.pb(-1);
}
dis[0] = 1;
q.push(0);
int cur;
int sus;
while(!q.empty()) {
cur = q.front();
q.pop();
for(int i = 0; i < (int) edges[cur].size(); i++) {
sus = edges[cur][i].F;
if(dis[sus] == 0) {
q.push(sus);
dis[sus] = dis[cur]+1;
}
}
}
if(a>=3) {
q.push(0);
while(!q.empty()) {
cur = q.front();
q.pop();
for(int i = 0; i < (int) edges[cur].size(); i++) {
sus = edges[cur][i].F;
if(oznake[edges[cur][i].S] == -1) {
if(dis[sus] > dis[cur]) q.push(sus);
oznake[edges[cur][i].S] = (dis[cur] - 1) % 3;
}
}
}
}
else {
q.push(0);
while(!q.empty()) {
cur = q.front();
q.pop();
for(int i = 0; i < (int) edges[cur].size(); i++) {
sus = edges[cur][i].F;
if(oznake[edges[cur][i].S] == -1) {
if(dis[sus] > dis[cur]) q.push(sus);
oznake[edges[cur][i].S] = (zap[cur] + 1) % 2;
zap[sus] = (zap[cur] + 1) % 2;
}
}
}
}
return oznake;
}
} // namespace
std::vector<int> Mark(int N, int M, int A, int B,
std::vector<int> U, std::vector<int> V) {
std::vector<int> X(M);
return ::mark(N, M, A, B, U, V);
}
#include "Catherine.h"
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define pb push_back
#define F first
#define S second
#define pii pair < int, int >
#define FIO ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
namespace {
int ga, gb;
int l[2];
int pat[6] = {0, 1, 0, 0, 1, 1};
void init( int a, int b ) {
ga = a;
gb = b;
l[0] = 0;
l[1] = 0;
}
int move( vector < int > v ) {
if(::ga>=3) {
if(v[0] && v[1]) return 0;
if(v[2] && v[0]) return 2;
if(v[1] && v[2]) return 1;
if(!(v[0] || v[1])) return 2;
if(!(v[2] || v[0])) return 1;
if(!(v[1] || v[2])) return 0;
}
if(v[0] == 0 && v[1] == 0) return -1;
if(v[0] == 0 && v[1] > 1) {
return -1;
}
if(v[0] > 1 && v[1] == 0) {
return -1;
}
if(v[0] == 0 && v[1] == 1) {
l[1] = 1;
l[0] = 0;
return 1;
}
if(v[0] == 1 && v[1] == 0) {
l[1] = 0;
l[0] = 1;
return 0;
}
if(l[0]) {
l[1] = 1;
l[0] = 0;
return 1;
}
if(l[1]) {
l[1] = 0;
l[0] = 1;
return 0;
}
if(v[0] > v[1]) {
l[1] = 1;
l[0] = 0;
return 1;
}
l[1] = 0;
l[0] = 1;
return 0;
}
} // namespace
void Init(int A, int B) {
::init(A, B);
}
int Move(std::vector<int> y) {
return ::move(y);
}
Compilation message
Anthony.cpp:23:5: warning: '{anonymous}::pat' defined but not used [-Wunused-variable]
23 | int pat[6] = {0, 1, 0, 0, 1, 1};
| ^~~
Catherine.cpp:18:5: warning: '{anonymous}::pat' defined but not used [-Wunused-variable]
18 | int pat[6] = {0, 1, 0, 0, 1, 1};
| ^~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
16484 KB |
Output is correct |
2 |
Correct |
1 ms |
1308 KB |
Output is correct |
3 |
Correct |
22 ms |
15760 KB |
Output is correct |
4 |
Correct |
28 ms |
17496 KB |
Output is correct |
5 |
Correct |
27 ms |
17508 KB |
Output is correct |
6 |
Correct |
27 ms |
16208 KB |
Output is correct |
7 |
Correct |
24 ms |
16224 KB |
Output is correct |
8 |
Correct |
27 ms |
16988 KB |
Output is correct |
9 |
Correct |
28 ms |
16812 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
16484 KB |
Output is correct |
2 |
Correct |
1 ms |
1308 KB |
Output is correct |
3 |
Correct |
22 ms |
15760 KB |
Output is correct |
4 |
Correct |
28 ms |
17496 KB |
Output is correct |
5 |
Correct |
27 ms |
17508 KB |
Output is correct |
6 |
Correct |
27 ms |
16208 KB |
Output is correct |
7 |
Correct |
24 ms |
16224 KB |
Output is correct |
8 |
Correct |
27 ms |
16988 KB |
Output is correct |
9 |
Correct |
28 ms |
16812 KB |
Output is correct |
10 |
Correct |
20 ms |
14424 KB |
Output is correct |
11 |
Correct |
25 ms |
14324 KB |
Output is correct |
12 |
Correct |
22 ms |
14424 KB |
Output is correct |
13 |
Correct |
25 ms |
14456 KB |
Output is correct |
14 |
Correct |
22 ms |
14680 KB |
Output is correct |
15 |
Correct |
26 ms |
14928 KB |
Output is correct |
16 |
Correct |
24 ms |
17000 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
13920 KB |
Output is correct |
2 |
Correct |
1 ms |
1300 KB |
Output is correct |
3 |
Correct |
26 ms |
13380 KB |
Output is correct |
4 |
Correct |
31 ms |
15436 KB |
Output is correct |
5 |
Correct |
28 ms |
15416 KB |
Output is correct |
6 |
Correct |
24 ms |
13908 KB |
Output is correct |
7 |
Correct |
23 ms |
13916 KB |
Output is correct |
8 |
Correct |
27 ms |
14688 KB |
Output is correct |
9 |
Correct |
24 ms |
14756 KB |
Output is correct |
10 |
Correct |
24 ms |
14468 KB |
Output is correct |
11 |
Correct |
23 ms |
14440 KB |
Output is correct |
12 |
Correct |
22 ms |
14428 KB |
Output is correct |
13 |
Correct |
24 ms |
14292 KB |
Output is correct |
14 |
Correct |
26 ms |
14676 KB |
Output is correct |
15 |
Correct |
26 ms |
14688 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
13920 KB |
Output is correct |
2 |
Correct |
1 ms |
1300 KB |
Output is correct |
3 |
Correct |
26 ms |
13380 KB |
Output is correct |
4 |
Correct |
31 ms |
15436 KB |
Output is correct |
5 |
Correct |
28 ms |
15416 KB |
Output is correct |
6 |
Correct |
24 ms |
13908 KB |
Output is correct |
7 |
Correct |
23 ms |
13916 KB |
Output is correct |
8 |
Correct |
27 ms |
14688 KB |
Output is correct |
9 |
Correct |
24 ms |
14756 KB |
Output is correct |
10 |
Correct |
24 ms |
14468 KB |
Output is correct |
11 |
Correct |
23 ms |
14440 KB |
Output is correct |
12 |
Correct |
22 ms |
14428 KB |
Output is correct |
13 |
Correct |
24 ms |
14292 KB |
Output is correct |
14 |
Correct |
26 ms |
14676 KB |
Output is correct |
15 |
Correct |
26 ms |
14688 KB |
Output is correct |
16 |
Correct |
22 ms |
12368 KB |
Output is correct |
17 |
Correct |
22 ms |
12404 KB |
Output is correct |
18 |
Correct |
21 ms |
12372 KB |
Output is correct |
19 |
Correct |
23 ms |
12196 KB |
Output is correct |
20 |
Correct |
25 ms |
13144 KB |
Output is correct |
21 |
Correct |
25 ms |
12888 KB |
Output is correct |
22 |
Correct |
23 ms |
14952 KB |
Output is correct |
23 |
Correct |
25 ms |
12628 KB |
Output is correct |
24 |
Correct |
27 ms |
12632 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
1556 KB |
Output is correct |
2 |
Correct |
0 ms |
1300 KB |
Output is correct |
3 |
Correct |
1 ms |
1564 KB |
Output is correct |
4 |
Correct |
1 ms |
1572 KB |
Output is correct |
5 |
Correct |
2 ms |
1568 KB |
Output is correct |
6 |
Correct |
2 ms |
1572 KB |
Output is correct |
7 |
Correct |
1 ms |
1568 KB |
Output is correct |
8 |
Correct |
0 ms |
1572 KB |
Output is correct |
9 |
Correct |
2 ms |
1572 KB |
Output is correct |
10 |
Correct |
1 ms |
1568 KB |
Output is correct |
11 |
Correct |
0 ms |
1572 KB |
Output is correct |
12 |
Correct |
1 ms |
1572 KB |
Output is correct |
13 |
Correct |
0 ms |
1572 KB |
Output is correct |
14 |
Correct |
1 ms |
1568 KB |
Output is correct |
15 |
Correct |
1 ms |
1560 KB |
Output is correct |
16 |
Correct |
1 ms |
1564 KB |
Output is correct |
17 |
Correct |
2 ms |
1620 KB |
Output is correct |
18 |
Correct |
1 ms |
1572 KB |
Output is correct |
19 |
Correct |
1 ms |
1572 KB |
Output is correct |
20 |
Correct |
1 ms |
1584 KB |
Output is correct |
21 |
Correct |
1 ms |
1564 KB |
Output is correct |
22 |
Correct |
0 ms |
1564 KB |
Output is correct |
23 |
Correct |
1 ms |
1572 KB |
Output is correct |
24 |
Correct |
1 ms |
1572 KB |
Output is correct |
25 |
Correct |
1 ms |
1568 KB |
Output is correct |
26 |
Correct |
1 ms |
1572 KB |
Output is correct |
27 |
Correct |
1 ms |
1572 KB |
Output is correct |
28 |
Correct |
1 ms |
1572 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
25 ms |
12076 KB |
Output is correct |
2 |
Correct |
33 ms |
12696 KB |
Output is correct |
3 |
Correct |
1 ms |
1308 KB |
Output is correct |
4 |
Correct |
20 ms |
12084 KB |
Output is correct |
5 |
Correct |
27 ms |
13732 KB |
Output is correct |
6 |
Correct |
34 ms |
13736 KB |
Output is correct |
7 |
Incorrect |
22 ms |
12952 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
20 ms |
12128 KB |
Output is correct |
2 |
Correct |
24 ms |
12584 KB |
Output is correct |
3 |
Correct |
0 ms |
1352 KB |
Output is correct |
4 |
Correct |
16 ms |
12096 KB |
Output is correct |
5 |
Correct |
30 ms |
13648 KB |
Output is correct |
6 |
Correct |
28 ms |
13636 KB |
Output is correct |
7 |
Incorrect |
22 ms |
12892 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |