제출 #954451

#제출 시각아이디문제언어결과실행 시간메모리
954451__Davit__동굴 (IOI13_cave)C++17
13 / 100
24 ms604 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; namespace { } void exploreCave(int N) { int a[N]; for (int i = 0; i < N; i++)a[i] = 0; int x = tryCombination(a); while (x != -1) { int ina = 0, inb = N - 1, ans; while (ina <= inb) { int mid = (ina + inb) >> 1; for (int i = 0; i <= mid; i++)a[i] ^= 1; int y = tryCombination(a); if (x != y) { inb = mid - 1; ans = mid; } else { ina = mid + 1; } for (int i = 0; i <= mid; i++)a[i] ^= 1; } a[ans] ^= 1; x = tryCombination(a); } int b[N]; for (int i = 0; i < N; i++) { a[i] ^= 1; int x = tryCombination(a); a[i] ^= 1; b[i] = x; } answer(a, b); }

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

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:27:16: warning: 'ans' may be used uninitialized in this function [-Wmaybe-uninitialized]
   27 |         a[ans] ^= 1;
      |         ~~~~~~~^~~~
#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...