# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
710200 | MinhAnhnd | 길고양이 (JOI20_stray) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "Anthony.h"
#include <vector>
#include <bits/stdc++.h>
namespace {
int FunctionExample(int i, int A) {
return i % A;
}
} // namespace
std::vector<int> Mark(int N, int M, int A, int B,
std::vector<int> U, std::vector<int> V) {
std::vector<int> adj[20001];
int index[20001] = {};
std::vector<int> X(M);
std::queue<int> bfs;
bfs.push(0);
index[0] = 1;
for (int i = 0; i < M; ++i) {
adj[U[i]].push_back(V[i]);
adj[V[i]].push_back(U[i]);
}
while(!bfs.empty()){
int node = bfs.back();
bfs.pop();
for(auto child:adj[node]){
if(index[child]==0){
index[child] = index[node] + 1;
if(index[child]==4) index[child] = 1;
bfs.push(child);
}
}
}
for (int i = 0; i < M; ++i) {
int nodeA = index[U[i]];
int nodeB = index[V[i]];
if(nodeA > nodeB) std::swap(nodeA,nodeB);
if((nodeA == 1)&&(nodeB == 2)) X[i] = 0;
if((nodeA == 2)&&(nodeB == 3)) X[i] = 1;
if((nodeA == 1)&&(nodeB == 3)) X[i] = 2;
if((nodeA == 2)&&(nodeB == 2)) X[i] = 1;
if((nodeA == 3)&&(nodeB == 3)) X[i] = 2;
if((nodeA == 1)&&(nodeB == 1)) X[i] = 0;
}
return X;
}