# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
373001 | sam571128 | Magenta (COCI21_magenta) | C++14 | 68 ms | 9312 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
#define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 1e5+5;
vector<int> adj[N];
int dis[N];
void dfs(int u, int par){
for(auto v : adj[u]){
if(v==par) continue;
dis[v] = dis[u]+1;
dfs(v,u);
}
}
signed main(){
fastio
int n;
cin >> n;
int a,b;
cin >> a >> b;
for(int i = 1;i < n;i++){
int u,v; string s;
cin >> u >> v >> s;
adj[u].push_back(v);
adj[v].push_back(u);
}
dfs(a,-1);
if(dis[b]&1^1){
cout << "Paula\n";
}else{
cout << "Marin\n";
}
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |