#include "Anthony.h"
#include <bits/stdc++.h>
using namespace std;
#define f1r(i, a, b) for (int i = a; i < b; ++i)
#define f0r(i, a) f1r(i, 0, a)
#define each(t, a) for (auto& t : a)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define f first
#define s second
using vi = vector<int>;
using pi = pair<int, int>;
using vpi = vector<pi>;
using ll = long long;
// 0 -> 1 -> 2
vi Mark(int n, int m, int a, int b, vi U, vi V) {
vector<vi> g(n);
auto cp = [&](int u, int v) -> pi {
if (u > v) swap(u, v);
return mp(u, v);
};
map<pi, int> conv;
vpi ed;
vi res(m);
f0r(i, m) {
int u = U[i];
int v = V[i];
conv[cp(u, v)] = i;
g[u].pb(v);
g[v].pb(u);
ed.pb(cp(u, v));
}
if (a >= 3) { // bfs work
vi dist(n, -1);
list<int> que;
dist[0] = 0;
que.pb(0);
while (!que.empty()) {
int u = que.front();
que.pop_front();
each(v, g[u]) {
if (dist[v] != -1) continue;
dist[v] = dist[u] + 1;
que.push_back(v);
}
}
each(e, ed) {
int u = e.f;
int v = e.s;
int id = conv[cp(u, v)];
if (dist[u] == dist[v]) {
res[id] = dist[u] % 3;
} else {
if (dist[u] > dist[v]) {
swap(u, v);
}
res[id] = dist[u] % 3;
}
}
} else {
// do nothing for now
}
return res;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
#define f1r(i, a, b) for (int i = a; i < b; ++i)
#define f0r(i, a) f1r(i, 0, a)
#define each(t, a) for (auto& t : a)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define f first
#define s second
using vi = vector<int>;
using pi = pair<int, int>;
using vpi = vector<pi>;
using ll = long long;
namespace {
int a, b;
} // namespace
void Init(int A, int B) {
::a = A;
::b = B;
}
int MoveT(vi& y) { // fails right now
return -1;
}
int MoveG(vi& y) {
int a0 = y[0];
int a1 = y[1];
int a2 = y[2];
if (a0 && a1) {
return 0;
} else if (a1 && a2) {
return 1;
} else if (a2 && a0) {
return 2;
} else if (a0) {
return 0;
} else if (a1) {
return 1;
} else if (a2) {
return 2;
}
return -1;
}
int Move(vi y) {
if (a >= 3) {
return MoveG(y);
} else {
return MoveT(y);
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
60 ms |
16720 KB |
Output is correct |
2 |
Correct |
2 ms |
668 KB |
Output is correct |
3 |
Correct |
50 ms |
16648 KB |
Output is correct |
4 |
Correct |
68 ms |
17904 KB |
Output is correct |
5 |
Correct |
68 ms |
17880 KB |
Output is correct |
6 |
Correct |
62 ms |
16596 KB |
Output is correct |
7 |
Correct |
56 ms |
16568 KB |
Output is correct |
8 |
Correct |
70 ms |
17236 KB |
Output is correct |
9 |
Correct |
64 ms |
17280 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
60 ms |
16720 KB |
Output is correct |
2 |
Correct |
2 ms |
668 KB |
Output is correct |
3 |
Correct |
50 ms |
16648 KB |
Output is correct |
4 |
Correct |
68 ms |
17904 KB |
Output is correct |
5 |
Correct |
68 ms |
17880 KB |
Output is correct |
6 |
Correct |
62 ms |
16596 KB |
Output is correct |
7 |
Correct |
56 ms |
16568 KB |
Output is correct |
8 |
Correct |
70 ms |
17236 KB |
Output is correct |
9 |
Correct |
64 ms |
17280 KB |
Output is correct |
10 |
Correct |
54 ms |
14748 KB |
Output is correct |
11 |
Correct |
53 ms |
14744 KB |
Output is correct |
12 |
Correct |
53 ms |
14620 KB |
Output is correct |
13 |
Correct |
53 ms |
14588 KB |
Output is correct |
14 |
Correct |
54 ms |
14788 KB |
Output is correct |
15 |
Correct |
60 ms |
15180 KB |
Output is correct |
16 |
Correct |
62 ms |
17448 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
65 ms |
14324 KB |
Output is correct |
2 |
Correct |
2 ms |
472 KB |
Output is correct |
3 |
Correct |
48 ms |
14292 KB |
Output is correct |
4 |
Correct |
65 ms |
15712 KB |
Output is correct |
5 |
Correct |
64 ms |
15708 KB |
Output is correct |
6 |
Correct |
57 ms |
14452 KB |
Output is correct |
7 |
Correct |
55 ms |
14424 KB |
Output is correct |
8 |
Correct |
61 ms |
14960 KB |
Output is correct |
9 |
Correct |
61 ms |
14940 KB |
Output is correct |
10 |
Correct |
57 ms |
14704 KB |
Output is correct |
11 |
Correct |
59 ms |
14692 KB |
Output is correct |
12 |
Correct |
57 ms |
14816 KB |
Output is correct |
13 |
Correct |
56 ms |
14684 KB |
Output is correct |
14 |
Correct |
64 ms |
15208 KB |
Output is correct |
15 |
Correct |
62 ms |
14968 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
65 ms |
14324 KB |
Output is correct |
2 |
Correct |
2 ms |
472 KB |
Output is correct |
3 |
Correct |
48 ms |
14292 KB |
Output is correct |
4 |
Correct |
65 ms |
15712 KB |
Output is correct |
5 |
Correct |
64 ms |
15708 KB |
Output is correct |
6 |
Correct |
57 ms |
14452 KB |
Output is correct |
7 |
Correct |
55 ms |
14424 KB |
Output is correct |
8 |
Correct |
61 ms |
14960 KB |
Output is correct |
9 |
Correct |
61 ms |
14940 KB |
Output is correct |
10 |
Correct |
57 ms |
14704 KB |
Output is correct |
11 |
Correct |
59 ms |
14692 KB |
Output is correct |
12 |
Correct |
57 ms |
14816 KB |
Output is correct |
13 |
Correct |
56 ms |
14684 KB |
Output is correct |
14 |
Correct |
64 ms |
15208 KB |
Output is correct |
15 |
Correct |
62 ms |
14968 KB |
Output is correct |
16 |
Correct |
50 ms |
12960 KB |
Output is correct |
17 |
Correct |
50 ms |
12988 KB |
Output is correct |
18 |
Correct |
53 ms |
12628 KB |
Output is correct |
19 |
Correct |
52 ms |
12632 KB |
Output is correct |
20 |
Correct |
55 ms |
13288 KB |
Output is correct |
21 |
Correct |
54 ms |
13036 KB |
Output is correct |
22 |
Correct |
60 ms |
15200 KB |
Output is correct |
23 |
Correct |
52 ms |
12800 KB |
Output is correct |
24 |
Correct |
55 ms |
12824 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
876 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
44 ms |
12020 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
45 ms |
12076 KB |
Wrong Answer [4] |
2 |
Halted |
0 ms |
0 KB |
- |