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 <bits/stdc++.h>
using namespace std;
namespace {
struct edge {
int from, to, idx;
};
vector< vector<edge> > g;
vector<int> solve1234(int N, int M, vector<int> U, vector<int> V) {
queue<int> q;
q.push(0);
vector<int> dist(N, -1), p(N, -1), ans(M);
dist[0] = 0;
while (!q.empty()) {
int u = q.front(); q.pop();
for (auto& e : g[u]) {
if (dist[e.to] == -1) {
dist[e.to] = dist[u] + 1;
ans[e.idx] = dist[u] % 3;
p[e.to] = u;
q.push(e.to);
} else if (e.to != p[u]) {
ans[e.idx] = dist[u] % 3;
}
}
}
return ans;
}
vector<int> solve567(int N, int M, vector<int> U, vector<int> V) {
}
}
vector<int> Mark(int N, int M, int A, int B, vector<int> U, vector<int> V) {
g.resize(N);
for (int i = 0; i < M; i++) {
g[U[i]].push_back({U[i], V[i], i});
g[V[i]].push_back({V[i], U[i], i});
}
if (A >= 3) {
return solve1234(N, M, U, V);
} else {
return solve567(N, M, U, V);
}
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
namespace {
int A, B;
}
void Init(int A, int B) {
::A = A; ::B = B;
}
int Move(vector<int> y) {
if (A >= 3) {
for (int i = 0; i < 3; i++) {
if (y[i] != 0 && y[(i + 1) % 3] != 0) {
return i;
}
}
for (int i = 0; i < 3; i++) {
if (y[i] != 0) {
return i;
}
}
} else {
}
}
Compilation message (stderr)
Anthony.cpp: In function 'std::vector<int> {anonymous}::solve567(int, int, std::vector<int>, std::vector<int>)':
Anthony.cpp:34:3: warning: no return statement in function returning non-void [-Wreturn-type]
}
^
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:28:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# | 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... |