이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
vector<vector<vector<int>>> ve;
vector<int> dist;
void dfs(int x, int p, int depth){
dist[x] = depth;
for (auto el : ve[x]){
if (el[0] != p){
dfs(el[0], x, depth + 1);
}
}
}
int main(){
int n, sp1, sp2, a, b;
string col;
cin>>n>>sp1>>sp2;
sp1--, sp2--;
dist.assign(n, 0);
ve.resize(n);
for (int i = 0; i < n - 1; i++){
cin>>a>>b>>col;
a--, b--;
ve[a].push_back({b, 2});
ve[b].push_back({a, 2});
}
dfs(sp1, sp1, 0);
if (dist[sp2] % 2 == 1){
cout<<"Marin";
}
else{
cout<<"Paula";
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |