제출 #149257

#제출 시각아이디문제언어결과실행 시간메모리
149257강력한 한방 필살기 (#200)Bulb Game (FXCUP4_bulb)C++17
0 / 100
2 ms348 KiB
#include "bulb.h" #include<stdio.h> using namespace std; const int N=301010; int lblue[N],rlblue[N],lrlblue[N]; vector<int> L, R; void dfs(int u){ if(L[u]>=0){ dfs(L[u]); lblue[u]=lblue[L[u]]; } else if(L[u]==-2)lblue[u]=1; if(R[u]>=0){ dfs(R[u]); rlblue[u]=lblue[R[u]]; } else if(R[u]==-2)rlblue[u]=1; lrlblue[u]=rlblue[u]; if(L[u]>=0)lrlblue[u]|=lrlblue[L[u]]; } int FindWinner(int T, std::vector<int> L, std::vector<int> R){ ::L=L,::R=R; int n = L.size(); int cur = 0; while(cur>=0)cur=L[cur]; if(cur==-2)return 0; cur=0; int curlr=0; dfs(0); while(cur>=0){ bool bad=false; if(R[cur]>=0&&lrlblue[R[cur]])bad=true; if(curlr)bad=true; if(!bad)return 1; curlr|=rlblue[cur]; cur=L[cur]; } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

bulb.cpp: In function 'int FindWinner(int, std::vector<int>, std::vector<int>)':
bulb.cpp:26:6: warning: unused variable 'n' [-Wunused-variable]
  int n = L.size();
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...