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>
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 (stderr)
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 |
---|
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... |