Submission #933254

#TimeUsernameProblemLanguageResultExecution timeMemory
933254SmuggingSpunCave (IOI13_cave)C++14
0 / 100
75 ms492 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 = mid + 1; j < n; j++){ if(!vis.test(j)){ S[j] ^= 1; } } if(tryCombination(S) == i){ high = (ans = mid) - 1; } else{ low = mid + 1; } for(int j = mid + 1; j < n; j++){ if(!vis.test(j)){ S[j] ^= 1; } } } D[ans] = i; vis.set(ans); } answer(S, D); }

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