# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
149695 | 욱방켜!! (twitch.tv/wookje) (#200) | Bulb Game (FXCUP4_bulb) | C++17 | 2 ms | 376 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "bulb.h"
std::vector<int> L, R;
int dist[300000], mdist;
void dfs(int c, int v)
{
mdist=std::max(mdist,v);
if(L[c]>=0) {
dist[L[c]]=dist[c]+1;
dfs(L[c],v);
}
if(R[c]>=0) {
dist[R[c]]=dist[c]+1;
dfs(R[c],v+1);
}
}
int FindWinner(int T, std::vector<int> L, std::vector<int> R){
int N = L.size(), c, n;
std::vector<int> temp;
::L=L; ::R=R;
for(c=0;c>=0;c=L[c]) {
for(n=R[c];n>=0;n=L[n]);
if(n==-2) {
if(R[c]==-2) return 0;
temp.push_back(R[c]);
}
}
if(c==-2 || temp.size()>1) return 0;
dfs(0,0);
if(temp.empty()) {
if(mdist>1) return 1;
int t=0;
for(c=0;c>=0;c=L[c]) {
for(n=R[c];n>=0;n=L[n]) {
for(t=R[n];t>=0;t=L[t]);
if(t==-1) return 1;
}
}
return 0;
}
for(c=temp[0];c>=0;c=L[c]) {
for(n=R[c];n>=0;n=L[n]);
if(n==-1) return 1;
}
return 0;
}
컴파일 시 표준 에러 (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... |