Submission #945437

#TimeUsernameProblemLanguageResultExecution timeMemory
945437codefoxCave (IOI13_cave)C++14
0 / 100
74 ms524 KiB
#include<bits/stdc++.h> #include "cave.h" using namespace std; const int M = 1<<13; void exploreCave(int N) { int b[N]; int ans[N]; for (int i = 0; i < N; i++) { b[i] = 0; ans[i] = -1; } int f = tryCombination(b); for (int i = 0; i < N; i++) { if (f !=i) { for (int j = 0; j < N; j++) { if (ans[j]==-1) b[j] = 1-b[j]; } } int curr = 0; for (int j = 12; j >= 0; j--) { for (int k = curr; k < curr + 1<<j && k <N; k++) { if (ans[k]==-1) b[k] = 1-b[k]; } int h = tryCombination(b); for (int k = curr; k < curr + 1<<j && k <N; k++) { if (ans[k]==-1) b[k] = 1-b[k]; } if (h != i) continue; curr += 1<<j; } b[curr] = 1-b[curr]; ans[curr] = i; f = tryCombination(b); } answer(b, ans); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:31:41: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   31 |             for (int k = curr; k < curr + 1<<j && k <N; k++)
      |                                    ~~~~~^~~
cave.cpp:36:41: warning: suggest parentheses around '+' inside '<<' [-Wparentheses]
   36 |             for (int k = curr; k < curr + 1<<j && k <N; k++)
      |                                    ~~~~~^~~
#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...