이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
vector<int> adj[200100];
int ans[101][101][2];
void dfs(int n, int p, int t, int d) {
if(n==t)
cout << (d?"Marin":"Paula"),exit(0);
for(auto i: adj[n])
if(i-p)
dfs(i,n,t,!d);
}
int dfs2(int a, int b, int t) {
for(auto i: adj[a])
if(i!=3-t)
return ans[i][b][t];
for(auto i: adj[b])
if(i!=3-t)
return ans[a][i][t];
}
int main() {
cin.sync_with_stdio(false);
cin.tie(nullptr);
int n, a, b;
cin >> n >> a >> b;
for(int i = 1; i < n; i++) {
int x, y;
string str;
cin >> x >> y >> str;
adj[x].push_back(y);
adj[y].push_back(x);
}
dfs(a,0,b,0);
dfs2(a,b,0);
}
컴파일 시 표준 에러 (stderr) 메시지
Main.cpp: In function 'int dfs2(int, int, int)':
Main.cpp:19:1: warning: control reaches end of non-void function [-Wreturn-type]
19 | }
| ^| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |