이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |