제출 #629389

#제출 시각아이디문제언어결과실행 시간메모리
629389Stavab동굴 (IOI13_cave)C++14
0 / 100
79 ms460 KiB
#include "cave.h" void exploreCave(int n) { int s[n], d[n]; for(int i = 0; i < n; i++) { s[i] = 0; d[i] = -1; } int cur, prev, door; for(int i = 0; i < n; i++) { door = tryCombination(s); if(door > i || door == -1) prev = 1; else prev = 0; int low = 0, high = n; while(high - low > 1) { int middle = (low + high) / 2; for(int j = low; j <= middle; j++) { if(d[j] != -1) continue; if(s[j]) s[j] = 0; else s[j] = 1; } door = tryCombination(s); if(door > i || door == -1) cur = 1; else cur = 0; if(cur == prev) low = middle; else high = middle; prev = cur; } if(d[low] == -1) { if(s[low]) s[low] = 0; else s[low] = 1; door = tryCombination(s); if(door > i || door == -1) cur = 1; else cur = 0; } int ind; if(cur == prev) { d[high] = i; ind = high; } else { d[low] = i; ind = low; } door = tryCombination(s); if(door <= i) { if(s[ind]) s[ind] = 0; else s[ind] = 1; } } answer(s, d); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:60:9: warning: 'cur' may be used uninitialized in this function [-Wmaybe-uninitialized]
   60 |         if(cur == prev)
      |         ^~
#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...