Submission #318794

#TimeUsernameProblemLanguageResultExecution timeMemory
318794jerrymonkeyCave (IOI13_cave)C++14
0 / 100
321 ms364 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave (int N) { int known[N], correctSw[N]; for (int i = 0; i < N; i++) known[i] = -1; for (int i = 0; i < N; i++) { int segLen = pow(2, __lg(N - i - 1)); int output[N]; for (int i = 0; i < N; i++) output[i] = known[i]; bool f = false; int c = 0, pos = 0; for (int j = 0; j < N; j++) { if (output[j] == -1) output[j] = 0; } bool doorSw = 0; if (tryCombination(output) > i) doorSw = 0; else doorSw = 1; while (1) { for (int j = 0; j < N; j++) { if (output[j] == -1) { output[j] = ((c / segLen + doorSw) % 2); c++; } } if (!tryCombination(output) > i) pos = pos | (1 << __lg(segLen)); if (segLen == 1) break; segLen /= 2; } int k = 0; for (int j = 0; j < N; j++) { if (known[j] == -1) { if (k == pos) { known[j] = doorSw; correctSw[doorSw] = i; break; } k++; } } } answer(known, correctSw); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:35:32: warning: logical not is only applied to the left hand side of comparison [-Wlogical-not-parentheses]
   35 |    if (!tryCombination(output) > i)
      |                                ^
cave.cpp:35:8: note: add parentheses around left hand side expression to silence this warning
   35 |    if (!tryCombination(output) > i)
      |        ^~~~~~~~~~~~~~~~~~~~~~~
      |        (                      )
cave.cpp:17:14: warning: unused variable 'f' [-Wunused-variable]
   17 |         bool f = false;
      |              ^
#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...