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 ivan {
vector<vector<pair<int, int>>> adj;
vector<int> dist, c;
void dfs(int u, int p) {
for (auto& [v, id] : adj[u]) if (v != p) {
dist[v] = (dist[u] + 1) % 3;
c[id] = dist[v];
dfs(v, u);
}
}
};
using namespace ivan;
vector<int> Mark(int n, int m, int a, int b,
vector<int> u, vector<int> v) {
vector<int> x(m);
adj.resize(n);
c.resize(m);
dist.assign(n, 0);
for (int i = 0; i < m; i++) {
adj[u[i]].push_back({v[i], i});
adj[v[i]].push_back({u[i], i});
}
dfs(0, -1);
return c;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
namespace ivan {
int a, b;
};
using namespace ivan;
void Init(int A, int B) {
a = A, b = B;
}
int Move(vector<int> cnt) {
set<int> hv;
for (int i = 0; i < a; i++) if (cnt[i]) hv.insert(i);
if ((int) hv.size() == 1) return *hv.begin();
if (!hv.count(1)) return 2;
if (!hv.count(2)) return 0;
if (!hv.count(0)) return 1;
}
Compilation message (stderr)
Catherine.cpp: In function 'int Move(std::vector<int>)':
Catherine.cpp:16:14: warning: control reaches end of non-void function [-Wreturn-type]
16 | set<int> hv;
| ^~
# | 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... |