This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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) {
if (a == b - 1) return a;
if (b == a - 1) return b;
return 2;
}
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 (stderr)
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |