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;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<pi, int> pii;
typedef pair<int, pi> ipi;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define aint(v) v.begin(), v.end()
#define size(v) (int) v.size()
#define disc(v) sort(aint(v)); v.resize(unique(aint(v)) - v.begin());
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sandybridge __attribute__((optimize("Ofast"), target("arch=sandybridge")))
int n, m, dist[20005];
vpi adj[20005];
vi ans;
queue<int> q;
vi Mark(int N, int M, int A, int B, vi U, vi V) {
n = N, m = M;
FOR(i, 0, m-1) {
adj[U[i]].pb(pi(V[i], i));
adj[V[i]].pb(pi(U[i], i));
}
memset(dist, -1, sizeof dist);
dist[0] = 0; q.push(0);
while (!q.empty()) {
int x = q.front(); q.pop();
for (auto [it, idx]:adj[x]) {
if (dist[it] == -1) {
dist[it] = dist[x] + 1;
q.push(it);
}
}
}
FOR(i, 0, m-1) {
int u = U[i], v = V[i];
if (dist[u] > dist[v]) swap(u, v);
ans.pb(dist[u] % 3);
}
return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
#define FOR(i, a, b) for(int i = (int)a; i <= (int)b; i++)
#define DEC(i, a, b) for(int i = (int)a; i >= (int)b; i--)
typedef pair<int, int> pi;
typedef pair<pi, int> pii;
typedef pair<int, pi> ipi;
typedef pair<pi, pi> pipi;
#define f first
#define s second
typedef vector<int> vi;
typedef vector<pi> vpi;
typedef vector<pii> vpii;
#define pb push_back
#define pf push_front
#define aint(v) v.begin(), v.end()
#define size(v) (int) v.size()
#define disc(v) sort(aint(v)); v.resize(unique(aint(v)) - v.begin());
#define INF (int) 1e9 + 100
#define LLINF (ll) 1e18
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define sandybridge __attribute__((optimize("Ofast"), target("arch=sandybridge")))
void Init(int A, int B) {
}
int Move(vi v) {
if (v[0] and v[1]) return 0;
else if (v[1] and v[2]) return 1;
else if (v[2] and v[0]) return 2;
else FOR(i, 0, 2) if (v[i]) return i;
assert(false);
}
# | 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... |