#include "Anthony.h"
#include <vector>
using namespace std;
typedef int ll;
#define MAX 101010
namespace {
vector<ll> adj[MAX], num[MAX], depth;
vector<ll> ret;
void dfs(ll x = 0, ll p = -1, ll d = 1) {
depth[x] = d;
ll i;
for (i = 0; i < adj[x].size(); i++) {
if (adj[x][i] == p) continue;
dfs(adj[x][i], x, !d);
ret[num[x][i]] = d;
}
}
} // namespace
std::vector<int> Mark(int N, int M, int A, int B, std::vector<int> U, std::vector<int> V) {
ret.resize(M);
ll i;
for (i = 0; i < M; i++) adj[U[i]].push_back(V[i]);
for (i = 0; i < M; i++) num[U[i]].push_back(i);
for (i = 0; i < M; i++) adj[V[i]].push_back(U[i]);
for (i = 0; i < M; i++) num[V[i]].push_back(i);
depth.resize(N);
dfs();
return ret;
}
#include "Catherine.h"
#include <vector>
using namespace std;
typedef int ll;
namespace {
int A, B;
int variable_example = 0;
ll pv;
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
pv = -1;
}
int Move(std::vector<int> y) {
if (!(y[0] + y[1])) return -1;
if (pv == -1) {
if (y[0]) return pv = 0;
else return pv = 1;
}
return pv = (1 - pv);
}
Compilation message
Anthony.cpp: In function 'void {anonymous}::dfs(ll, ll, ll)':
Anthony.cpp:13:17: warning: comparison of integer expressions of different signedness: 'll' {aka 'int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
13 | for (i = 0; i < adj[x].size(); i++) {
| ~~^~~~~~~~~~~~~~~
Catherine.cpp:9:5: warning: '{anonymous}::variable_example' defined but not used [-Wunused-variable]
9 | int variable_example = 0;
| ^~~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
63 ms |
21244 KB |
Output is correct |
2 |
Correct |
3 ms |
5228 KB |
Output is correct |
3 |
Incorrect |
45 ms |
20080 KB |
Wrong Answer [6] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
63 ms |
21244 KB |
Output is correct |
2 |
Correct |
3 ms |
5228 KB |
Output is correct |
3 |
Incorrect |
45 ms |
20080 KB |
Wrong Answer [6] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
18912 KB |
Output is correct |
2 |
Correct |
3 ms |
5232 KB |
Output is correct |
3 |
Incorrect |
46 ms |
17760 KB |
Wrong Answer [6] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
18912 KB |
Output is correct |
2 |
Correct |
3 ms |
5232 KB |
Output is correct |
3 |
Incorrect |
46 ms |
17760 KB |
Wrong Answer [6] |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
5632 KB |
Output is correct |
2 |
Correct |
3 ms |
5316 KB |
Output is correct |
3 |
Correct |
4 ms |
5632 KB |
Output is correct |
4 |
Correct |
4 ms |
5620 KB |
Output is correct |
5 |
Correct |
5 ms |
5528 KB |
Output is correct |
6 |
Correct |
5 ms |
5632 KB |
Output is correct |
7 |
Correct |
5 ms |
5620 KB |
Output is correct |
8 |
Correct |
4 ms |
5624 KB |
Output is correct |
9 |
Correct |
5 ms |
5576 KB |
Output is correct |
10 |
Correct |
4 ms |
5624 KB |
Output is correct |
11 |
Correct |
5 ms |
5628 KB |
Output is correct |
12 |
Correct |
5 ms |
5580 KB |
Output is correct |
13 |
Correct |
5 ms |
5616 KB |
Output is correct |
14 |
Correct |
5 ms |
5620 KB |
Output is correct |
15 |
Correct |
4 ms |
5620 KB |
Output is correct |
16 |
Correct |
5 ms |
5620 KB |
Output is correct |
17 |
Correct |
4 ms |
5576 KB |
Output is correct |
18 |
Correct |
4 ms |
5528 KB |
Output is correct |
19 |
Correct |
5 ms |
5572 KB |
Output is correct |
20 |
Correct |
5 ms |
5628 KB |
Output is correct |
21 |
Correct |
5 ms |
5620 KB |
Output is correct |
22 |
Correct |
5 ms |
5624 KB |
Output is correct |
23 |
Correct |
4 ms |
5588 KB |
Output is correct |
24 |
Correct |
4 ms |
5620 KB |
Output is correct |
25 |
Correct |
6 ms |
5564 KB |
Output is correct |
26 |
Correct |
5 ms |
5624 KB |
Output is correct |
27 |
Correct |
4 ms |
5572 KB |
Output is correct |
28 |
Correct |
5 ms |
5620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
50 ms |
16560 KB |
Output is correct |
2 |
Correct |
61 ms |
17596 KB |
Output is correct |
3 |
Correct |
4 ms |
5232 KB |
Output is correct |
4 |
Correct |
43 ms |
16368 KB |
Output is correct |
5 |
Correct |
71 ms |
19220 KB |
Output is correct |
6 |
Correct |
55 ms |
19336 KB |
Output is correct |
7 |
Incorrect |
44 ms |
18416 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
16528 KB |
Output is correct |
2 |
Correct |
60 ms |
17384 KB |
Output is correct |
3 |
Correct |
3 ms |
5232 KB |
Output is correct |
4 |
Correct |
44 ms |
16172 KB |
Output is correct |
5 |
Correct |
72 ms |
19176 KB |
Output is correct |
6 |
Correct |
56 ms |
19164 KB |
Output is correct |
7 |
Incorrect |
47 ms |
18352 KB |
Wrong Answer [6] |
8 |
Halted |
0 ms |
0 KB |
- |