#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 |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
108 ms |
17856 KB |
Output is correct |
2 |
Correct |
116 ms |
17744 KB |
Output is correct |
3 |
Correct |
109 ms |
17744 KB |
Output is correct |
4 |
Correct |
108 ms |
17748 KB |
Output is correct |
5 |
Correct |
120 ms |
17656 KB |
Output is correct |
6 |
Correct |
1 ms |
600 KB |
Output is correct |
7 |
Correct |
1 ms |
348 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |