제출 #933249

#제출 시각아이디문제언어결과실행 시간메모리
933249SmuggingSpun동굴 (IOI13_cave)C++17
0 / 100
533 ms544 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; const int lim = 5e3 + 5; int S[lim], D[lim]; bitset<lim>vis; void exploreCave(int n){ vis.reset(); for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(!vis.test(j)){ S[j] = 0; } } if(tryCombination(S) != i){ for(int j = 0; j < n; j++){ if(!vis.test(j)){ S[j] = 1; } } } int low = 0, high = n - 1, ans; while(low <= high){ int mid = (low + high) >> 1; for(int j = 0; j <= mid; j++){ if(!vis.test(j)){ S[j] ^= 1; } } if(tryCombination(S) == i){ high = (ans = mid) - 1; } else{ low = mid + 1; } for(int j = 0; j <= mid; j++){ if(!vis.test(j)){ S[j] ^= 1; } } } vis.set(D[i] = ans); } answer(S, D); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:22:30: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   22 |   int low = 0, high = n - 1, ans;
      |                              ^~~
#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...