Submission #954451

#TimeUsernameProblemLanguageResultExecution timeMemory
954451__Davit__Cave (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); }

Compilation message (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...