Submission #528229

#TimeUsernameProblemLanguageResultExecution timeMemory
528229happypotatoCave (IOI13_cave)C++17
0 / 100
155 ms452 KiB
#include "cave.h" #include <bits/stdc++.h> #define pb push_back using namespace std; void exploreCave(int n) { vector<int> bit; for (int i = 0; i < n; i++) bit.pb(i); int S[n], D[n]; for (int i = 0; i < n; i++) S[i] = 0; for (int i = 0; i < n; i++) { int res = tryCombination(S); bool open = (res >= i + 1); if (res == -1) open = true; int lb = 0, rb = bit.size() - 1; while (lb < rb) { int mid = (lb + rb) >> 1; for (int j = lb; j <= mid; j++) S[bit[j]] ^= 1; int res2 = tryCombination(S); bool open2 = (res2 >= i + 1); if (res2 == -1) open2 = true; for (int j = lb; j <= mid; j++) S[bit[j]] ^= 1; if (res == res2) lb = mid + 1; else rb = mid; } D[i] = lb; if (!open) S[D[i]] ^= 1; } answer(S, D); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:19:18: warning: variable 'open2' set but not used [-Wunused-but-set-variable]
   19 |             bool open2 = (res2 >= i + 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...