Submission #52124

#TimeUsernameProblemLanguageResultExecution timeMemory
52124rondojimCave (IOI13_cave)C++17
0 / 100
39 ms512 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; const int MAXN = 5e3 + 5; int st[MAXN], con[MAXN], cnt, n; int tryCombination(int S[]); void answer(int S[], int D[]); void solve(int ret){ int lo = 1, hi = n, mid, res, r; while(lo <= hi){ mid = (lo + hi)>>1; for(int i=1; i<=mid; ++i) st[i] ^= 1; r = tryCombination(st); for(int i=1; i<=mid; ++i) st[i] ^= 1; if(r != ret) hi = mid - 1, res = mid; else lo = mid + 1; } st[res] ^= 1; } void exploreCave(int N){ n = N; while(true){ int ret = tryCombination(st); if(ret == -1){ for(int i=1; i<=N; ++i){ st[i] ^= 1; con[i] = tryCombination(st); st[i] ^= 1; } break; } solve(ret); } }

Compilation message (stderr)

cave.cpp: In function 'void solve(int)':
cave.cpp:22:10: warning: 'res' may be used uninitialized in this function [-Wmaybe-uninitialized]
  st[res] ^= 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...