#include "Anthony.h"
#include <vector>
#include<queue>
#include<iostream>
using namespace std;
namespace {
int FunctionExample(int i, int A) {
return i % A;
}
} // namespace
int n, m;
int f(int a, int b) {
return a == (b + 1) % 3 ? b : a;
}
vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) {
n = N; m = M;
vector<vector<int>> g(n);
for (int i = 0; i < m; i++) {
g[U[i]].push_back(V[i]);
g[V[i]].push_back(U[i]);
}
vector<int> dist(n, 1e9);
dist[0] = 0;
queue<int> q;
q.push(0);
while (q.size()) {
int u = q.front(); q.pop();
for (int j : g[u]) {
if (dist[j] > dist[u] + 1) {
dist[j] = dist[u] + 1;
q.push(j);
}
}
}
//for (int i = 0; i < n; i++) cout << dist[i] << ' '; cout << endl;
vector<int> res(m);
for (int i = 0; i < m; i++) {
//cout << dist[U[i]] << ' ' << dist[V[i]] << endl;
res[i] = f(dist[U[i]] % 3, dist[V[i]] % 3);
}
return res;
}
#include "Catherine.h"
#include <vector>
#include <iostream>
using namespace std;
namespace {
int A, B;
}// namespace
int v = -1;
void Init(int A, int B) {
::A = A;
::B = B;
}
int Move(vector<int> y) {
if (v != -1) {
(v += 2) %= 3;
return v;
}
//for (int i : y) cout << i << ' '; cout<<endl;
if (y[0] && !y[2]) v = 0;
if (!y[1] && y[2]) v = 2;
if (!y[0] && y[1]) v = 1;
return v;
}
Compilation message
Anthony.cpp:9:9: warning: 'int {anonymous}::FunctionExample(int, int)' defined but not used [-Wunused-function]
9 | int FunctionExample(int i, int A) {
| ^~~~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
15620 KB |
Output is correct |
2 |
Correct |
1 ms |
796 KB |
Output is correct |
3 |
Correct |
25 ms |
15064 KB |
Output is correct |
4 |
Correct |
34 ms |
16736 KB |
Output is correct |
5 |
Correct |
47 ms |
16864 KB |
Output is correct |
6 |
Correct |
33 ms |
15412 KB |
Output is correct |
7 |
Correct |
36 ms |
15556 KB |
Output is correct |
8 |
Correct |
38 ms |
16208 KB |
Output is correct |
9 |
Correct |
39 ms |
16244 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
40 ms |
15620 KB |
Output is correct |
2 |
Correct |
1 ms |
796 KB |
Output is correct |
3 |
Correct |
25 ms |
15064 KB |
Output is correct |
4 |
Correct |
34 ms |
16736 KB |
Output is correct |
5 |
Correct |
47 ms |
16864 KB |
Output is correct |
6 |
Correct |
33 ms |
15412 KB |
Output is correct |
7 |
Correct |
36 ms |
15556 KB |
Output is correct |
8 |
Correct |
38 ms |
16208 KB |
Output is correct |
9 |
Correct |
39 ms |
16244 KB |
Output is correct |
10 |
Correct |
26 ms |
13484 KB |
Output is correct |
11 |
Correct |
34 ms |
13192 KB |
Output is correct |
12 |
Correct |
37 ms |
13448 KB |
Output is correct |
13 |
Correct |
25 ms |
13564 KB |
Output is correct |
14 |
Correct |
40 ms |
13760 KB |
Output is correct |
15 |
Correct |
30 ms |
14008 KB |
Output is correct |
16 |
Correct |
33 ms |
16232 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
13108 KB |
Output is correct |
2 |
Correct |
1 ms |
808 KB |
Output is correct |
3 |
Correct |
24 ms |
12592 KB |
Output is correct |
4 |
Correct |
39 ms |
14492 KB |
Output is correct |
5 |
Correct |
34 ms |
14684 KB |
Output is correct |
6 |
Correct |
28 ms |
13244 KB |
Output is correct |
7 |
Correct |
28 ms |
13072 KB |
Output is correct |
8 |
Correct |
36 ms |
13904 KB |
Output is correct |
9 |
Correct |
30 ms |
13892 KB |
Output is correct |
10 |
Correct |
28 ms |
13664 KB |
Output is correct |
11 |
Correct |
31 ms |
13684 KB |
Output is correct |
12 |
Correct |
40 ms |
13552 KB |
Output is correct |
13 |
Correct |
39 ms |
13440 KB |
Output is correct |
14 |
Correct |
31 ms |
13944 KB |
Output is correct |
15 |
Correct |
30 ms |
13936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
31 ms |
13108 KB |
Output is correct |
2 |
Correct |
1 ms |
808 KB |
Output is correct |
3 |
Correct |
24 ms |
12592 KB |
Output is correct |
4 |
Correct |
39 ms |
14492 KB |
Output is correct |
5 |
Correct |
34 ms |
14684 KB |
Output is correct |
6 |
Correct |
28 ms |
13244 KB |
Output is correct |
7 |
Correct |
28 ms |
13072 KB |
Output is correct |
8 |
Correct |
36 ms |
13904 KB |
Output is correct |
9 |
Correct |
30 ms |
13892 KB |
Output is correct |
10 |
Correct |
28 ms |
13664 KB |
Output is correct |
11 |
Correct |
31 ms |
13684 KB |
Output is correct |
12 |
Correct |
40 ms |
13552 KB |
Output is correct |
13 |
Correct |
39 ms |
13440 KB |
Output is correct |
14 |
Correct |
31 ms |
13944 KB |
Output is correct |
15 |
Correct |
30 ms |
13936 KB |
Output is correct |
16 |
Correct |
23 ms |
11580 KB |
Output is correct |
17 |
Correct |
27 ms |
12164 KB |
Output is correct |
18 |
Correct |
24 ms |
11364 KB |
Output is correct |
19 |
Correct |
24 ms |
11440 KB |
Output is correct |
20 |
Correct |
32 ms |
12128 KB |
Output is correct |
21 |
Correct |
26 ms |
11856 KB |
Output is correct |
22 |
Correct |
41 ms |
13936 KB |
Output is correct |
23 |
Correct |
27 ms |
11576 KB |
Output is correct |
24 |
Correct |
26 ms |
11728 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
784 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
2812 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
6 ms |
2888 KB |
Wrong Answer [2] |
2 |
Halted |
0 ms |
0 KB |
- |