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>
#define mp make_pair
#define F first
#define S second
#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(iter(a), greater<>())
#define eb emplace_back
#define printv(a, b) { \
for(auto pv : a) b << pv << " "; \
b << "\n"; \
}
using namespace std;
namespace {
} // namespace
vector<int> Mark(int n, int m, int A, int B,
vector<int> U, vector<int> V) {
assert(A >= 3);
vector<int> ans(m);
vector<vector<int>> g(n);
for(int i = 0; i < m; i++){
int u = U[i], v = V[i];
g[u].eb(v);
g[v].eb(u);
}
vector<int> dis(n, -1);
dis[0] = 0;
queue<int> q;
q.push(0);
while(!q.empty()){
int now = q.front();
q.pop();
for(int i : g[now]){
if(dis[i] != -1) continue;
dis[i] = dis[now] + 1;
q.push(i);
}
}
for(int i = 0; i < m; i++){
int u = U[i], v = V[i];
if(dis[u] > dis[v]) swap(u, v);
int t = dis[u] == dis[v] ? dis[v] + 1 : dis[v];
t %= 3;
ans[i] = t;
}
return ans;
}
#include "Catherine.h"
#include <bits/stdc++.h>
#define mp make_pair
#define F first
#define S second
#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
#define gsort(a) sort(iter(a), greater<>())
#define eb emplace_back
#define printv(a, b) { \
for(auto pv : a) b << pv << " "; \
b << "\n"; \
}
using namespace std;
namespace {
int A, B;
} // namespace
void Init(int A, int B) {
::A = A;
::B = B;
}
int Move(vector<int> y) {
vector<int> t;
for(int i = 0; i < A; i++){
if(y[i]) t.eb(i);
}
if(t.size() == 1) return t[0];
if(t[0] == 0 && t[1] == 2) return 2;
return t[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... |