Submission #988728

#TimeUsernameProblemLanguageResultExecution timeMemory
988728AriadnaCave (IOI13_cave)C++14
0 / 100
2 ms604 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int s[5000]; int pos[5000]; int door[5000]; void exploreCave(int N) { for (int d = 0; d < N; ++d) { int correct_pos = 0; for (int i = 0; i < N; ++i) if (pos[i] != -1) s[i] = pos[i]; else s[i] = 0; if (tryCombination(s) == d) correct_pos = 1; int l = 0, r = N-1, ans; while (l <= r) { int m = (l+r)/2; for (int i = 0; i < N; ++i) { if (pos[i] != -1) s[i] = pos[i]; else if (i < m) s[i] = correct_pos; else s[i] = 1-correct_pos; } int res = tryCombination(s); if (res > d || res == -1) { r = m-1; } else { ans = m; l = m+1; } } pos[ans] = correct_pos; door[ans] = d; } answer(pos, door); }

Compilation message (stderr)

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