Submission #812987

# Submission time Handle Problem Language Result Execution time Memory
812987 2023-08-07T12:31:55 Z tlnk07 Magenta (COCI21_magenta) C++17
30 / 110
99 ms 9140 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long

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);
}

signed 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 == 1)	cout << "Marin";
	else	cout << "Paula";
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Incorrect 2 ms 2644 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 77 ms 7048 KB Output is correct
2 Correct 99 ms 9056 KB Output is correct
3 Correct 86 ms 9140 KB Output is correct
4 Correct 74 ms 9000 KB Output is correct
5 Correct 76 ms 9000 KB Output is correct
6 Correct 1 ms 2644 KB Output is correct
7 Correct 1 ms 2660 KB Output is correct
8 Correct 1 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 2644 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Incorrect 2 ms 2644 KB Output isn't correct
4 Halted 0 ms 0 KB -