Submission #373268

#TimeUsernameProblemLanguageResultExecution timeMemory
373268rk42745417Magenta (COCI21_magenta)C++17
0 / 110
386 ms524292 KiB
#include <bits/stdc++.h> using namespace std; #define EMT ios::sync_with_stdio(0); cin.tie(0); using ll = int64_t; using ull = uint64_t; using uint = uint32_t; using ld = long double; const int MOD = 1e9 + 7; const int INF = 0x3f3f3f3f; const ll LINF = 2e18; const double EPS = 1e-9; signed main() { EMT int n; cin >> n; int x, y; cin >> x >> y; vector<vector<int>> edge(n + 1); for(int i = 1, a, b; i < n; i++) { cin >> a >> b; string s; cin >> s; edge[a].push_back(b); edge[b].push_back(a); } vector<bool> vis(n + 1); function<int(int, int)> dfs = [&](int u, int t) { if(vis[u]) return -1; if(u == t) return 0; for(int v : edge[u]) { int x = dfs(v, t); if(~x) return x + 1; } return -1; }; cout << (dfs(x, y) & 1 ? "Marin" : "Paula") << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...