제출 #149314

#제출 시각아이디문제언어결과실행 시간메모리
149314rkm0959 (#200)Bulb Game (FXCUP4_bulb)C++17
11 / 100
2 ms376 KiB
#include <bits/stdc++.h> using namespace std; bool bad(int x, vector<int>&L, vector<int>&R){ x=R[x]; while(x>=0) x=L[x]; return x==-2; } bool ok(int x, vector<int>&L, vector<int>&R){ x=R[x]; while(x>=0) { if(bad(x,L,R)) return 0; x=L[x]; } return x==-1; } bool existover2(int now,int dep, vector<int>&L, vector<int>&R){ if(now<0) return 0; if(dep>2) return 1; return existover2(L[now],dep,L,R) or existover2(R[now],dep+1,L,R); } bool changeok(int now, vector<int>&L, vector<int>&R){ now=R[now]; while(now>=0) now=L[now]; return now==-1; } bool checkgo(int now, vector<int>&L, vector<int>&R){ int temp=L[now]; while(temp>=0) { if(bad(temp,L,R)) return 0; temp=L[temp]; } now=R[now]; while(now>=0) { if(changeok(now,L,R)) return 1; now=L[now]; } return 0; } int FindWinner(int T, vector<int>L, vector<int>R){ int i; int temp=0; while(temp>=0) temp=L[temp]; if(temp==-2) return 0; temp=0; while(temp>=0) { if(ok(temp,L,R)) return 1; if(bad(temp,L,R)) return checkgo(temp,L,R); temp=L[temp]; } return existover2(0,0,L,R); }

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

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