Submission #373001

# Submission time Handle Problem Language Result Execution time Memory
373001 2021-03-03T01:01:39 Z sam571128 Magenta (COCI21_magenta) C++14
30 / 110
68 ms 9312 KB
#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

Main.cpp: In function 'int main()':
Main.cpp:33:11: warning: suggest parentheses around arithmetic in operand of '^' [-Wparentheses]
   33 |  if(dis[b]&1^1){
      |     ~~~~~~^~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2672 KB Output is correct
2 Correct 2 ms 2668 KB Output is correct
3 Incorrect 3 ms 2668 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 62 ms 9068 KB Output is correct
2 Correct 62 ms 9068 KB Output is correct
3 Correct 68 ms 9312 KB Output is correct
4 Correct 64 ms 9068 KB Output is correct
5 Correct 60 ms 9068 KB Output is correct
6 Correct 2 ms 2668 KB Output is correct
7 Correct 3 ms 2668 KB Output is correct
8 Correct 2 ms 2668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2672 KB Output is correct
2 Correct 2 ms 2668 KB Output is correct
3 Incorrect 3 ms 2668 KB Output isn't correct
4 Halted 0 ms 0 KB -