#pragma GCC optimize("O3", "inline")
#include <bits/stdc++.h>
using namespace std;
#define all(v) v.begin(), v.end()
#define ins insert
#define pb push_back
#define int long long int
#define pii pair<int, int>
#define endl '\n'
#define drop(x) cout<<(x)<<endl;return;
#define reach cerr << "reached >.<!" << endl;
/*
m : 11059739 -> l ~23
p : 4567896467
*/
// mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());
const int mod = 1e9 + 7, sze = 1e6 + 50, inf = 1e6, prime = 2333;
//\\
!!! dp ?recrusive? / binary search / greedy / sprase table / segment tree
//
vector<int> graph[sze];
int d=0;
int a,b;
void dfs(int node,int p,int di=0){
if(node==b){
d=di;
return;
}
for(auto v:graph[node]){
if(v!=p){
dfs(v,node,di+1);
}
}
}
void gkd(){
int n;
cin>>n;
cin>>a>>b;
for(int i=1;i<n;i++){
string s;
int u,v;cin>>u>>v;
cin>>s;
graph[u].pb(v);
graph[v].pb(u);
}
dfs(a,-1);
if(d%2==0){
drop("Paula");
}
drop("Marin");
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
int tt = 1; //cin>>tt;
while (tt--)gkd();
}
Compilation message
Main.cpp:19:1: warning: multi-line comment [-Wcomment]
19 | //\\
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
23896 KB |
Output is correct |
2 |
Correct |
9 ms |
23896 KB |
Output is correct |
3 |
Incorrect |
8 ms |
23900 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
41 ms |
28756 KB |
Output is correct |
2 |
Correct |
41 ms |
28756 KB |
Output is correct |
3 |
Correct |
42 ms |
28756 KB |
Output is correct |
4 |
Correct |
40 ms |
28764 KB |
Output is correct |
5 |
Correct |
41 ms |
28752 KB |
Output is correct |
6 |
Correct |
9 ms |
23896 KB |
Output is correct |
7 |
Correct |
9 ms |
23896 KB |
Output is correct |
8 |
Correct |
9 ms |
23944 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
23896 KB |
Output is correct |
2 |
Correct |
9 ms |
23896 KB |
Output is correct |
3 |
Incorrect |
8 ms |
23900 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |