Submission #648880

#TimeUsernameProblemLanguageResultExecution timeMemory
648880TruitadepatatesCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include "cave.h" void exploreCave(int n) { int S[n]; int D[n]; int Sol[n]; bool fet[n]; for (int i = 0; i < n; i++){ S[i] = 0; D[i] = -1; Sol[i] = -1; fet[i] = false; } if (tryCombination(S) == -1){ for (int i = 0; i < n; i++){ S[i] = 1; D[i] = tryCombination(S); S[i] = 0; } } else{ for (int i = 0; i < n; i++){ int hola; if (trycombination(S) == i) hola = 1; else hola = 0; int l = 0, r = n-1; while (l < r) { int m = (l+r)/2; for (int j = 0; j < n; j++) { if (fet[j]) Sol[j] = S[j]; else Sol[j] = 0; } for (int j = l; j <= m; j++){ if (not fet[j]){ Sol[j] = 1; } } if (hola == 1){ if (tryCombination(Sol) == i) l = mid+1; else r = mid; } else{ if (tryCombination(Sol) == i) r = mid; else l = mid+1; } } S[m] = hola; fet[m] = true; D[m] = i; } } answer(S, D); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:27:11: error: 'trycombination' was not declared in this scope; did you mean 'tryCombination'?
   27 |       if (trycombination(S) == i) hola = 1;
      |           ^~~~~~~~~~~~~~
      |           tryCombination
cave.cpp:42:45: error: 'mid' was not declared in this scope
   42 |           if (tryCombination(Sol) == i) l = mid+1;
      |                                             ^~~
cave.cpp:43:20: error: 'mid' was not declared in this scope
   43 |           else r = mid;
      |                    ^~~
cave.cpp:46:45: error: 'mid' was not declared in this scope
   46 |           if (tryCombination(Sol) == i) r = mid;
      |                                             ^~~
cave.cpp:47:20: error: 'mid' was not declared in this scope
   47 |           else l = mid+1;
      |                    ^~~
cave.cpp:50:9: error: 'm' was not declared in this scope
   50 |       S[m] = hola;
      |         ^