Submission #812976

#TimeUsernameProblemLanguageResultExecution timeMemory
812976tlnk07Magenta (COCI21_magenta)C++17
0 / 110
3 ms3664 KiB
#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;
		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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...