이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
long long n, a, b, x, y, height[100001];
string s;
vector<int> vec[100001];
void dfs(int x, int p, int h)
{
height[x] = h;
for(int c : vec[x]) if(c != p) dfs(c, x, h + 1);
}
int main()
{
cin >> n >> a >> b;
for(int i = 1; i < n; ++i)
{
cin >> x >> y >> s;
vec[x].push_back(y);
vec[y].push_back(x);
}
dfs(a, 0, 0);
if(height[b] % 2 == 0) 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... |