제출 #648951

#제출 시각아이디문제언어결과실행 시간메모리
648951tigar동굴 (IOI13_cave)C++14
100 / 100
926 ms540 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; bool check[5050]; int combs[5050], doors[5050]; void exploreCave(int n) { for(int br=0; br<n; br++) { for(int i=0; i<n; i++) if(!check[i])combs[i]=0; int beg=tryCombination(combs), opening=1; if(beg>br or beg==-1)opening=0; int l=0, r=n, midd=n/2; while(l<r) { for(int i=0; i<n; i++) if(!check[i]) if(i<l or i>midd)combs[i]=abs(opening-1); else combs[i]=opening; int begg=tryCombination(combs); if(begg>br or begg==-1){r=midd; midd=(l+r)/2;} else {l=midd+1; midd=(l+r)/2;} } combs[r]=opening; check[r]=true; doors[r]=br; } return answer(combs, doors); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:21:19: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   21 |                 if(!check[i])
      |                   ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...