Submission #988188

#TimeUsernameProblemLanguageResultExecution timeMemory
988188HasanV11010238Magenta (COCI21_magenta)C++17
30 / 110
120 ms17856 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...