#include<bits/stdc++.h>
using namespace std;
vector<int> adj[200100];
void dfs(int n, int p, int t, int d) {
if(n==t)
cout << (d?"Marin":"Paula"),exit(0);
for(auto i: adj[n])
if(i-p)
dfs(i,n,t,!d);
}
int main() {
cin.sync_with_stdio(false);
cin.tie(nullptr);
int n, a, b;
cin >> n >> a >> b;
for(int i = 1; i < n; i++) {
int x, y;
string str;
cin >> x >> y >> str;
adj[x].push_back(y);
adj[y].push_back(x);
}
dfs(a,0,b,0);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4956 KB |
Output is correct |
2 |
Correct |
1 ms |
4956 KB |
Output is correct |
3 |
Incorrect |
2 ms |
4956 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
28 ms |
10132 KB |
Output is correct |
2 |
Correct |
30 ms |
10068 KB |
Output is correct |
3 |
Correct |
29 ms |
10068 KB |
Output is correct |
4 |
Correct |
29 ms |
10068 KB |
Output is correct |
5 |
Correct |
29 ms |
10068 KB |
Output is correct |
6 |
Correct |
1 ms |
4956 KB |
Output is correct |
7 |
Correct |
1 ms |
4956 KB |
Output is correct |
8 |
Correct |
2 ms |
4956 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
4956 KB |
Output is correct |
2 |
Correct |
1 ms |
4956 KB |
Output is correct |
3 |
Incorrect |
2 ms |
4956 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |