Submission #1245242

#TimeUsernameProblemLanguageResultExecution timeMemory
1245242Martincho506Cave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include<iostream> using namespace std; const int MAXN = 5007; int connected[MAXN]; int a[MAXN], first; int f(int l, int r) { if(l == r) { connected[l] = first+1; return l; } int mid = (l+r)/2; for(int i = l; i <= r; i++) { if(connected[i] == -1) a[i] = 0; } for(int i = l; i <= mid; i++) { if(connected[i] == -1) a[i] = 1; } int nfirst = tryCombination(a); if(nfirst > first) r = mid; else l = mid+1; f(l, r); } void exploreCave(int n) { for(int i = 0; i < n; i++) { a[i] = 0; } first = tryCombination(a); while(first != n-1) { int idx = f(0, n-1); first = idx; } answer(a, connected); }

Compilation message (stderr)

cave.cpp: In function 'int f(int, int)':
cave.cpp:24:18: error: 'tryCombination' was not declared in this scope
   24 |     int nfirst = tryCombination(a);
      |                  ^~~~~~~~~~~~~~
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:36:13: error: 'tryCombination' was not declared in this scope
   36 |     first = tryCombination(a);
      |             ^~~~~~~~~~~~~~
cave.cpp:42:5: error: 'answer' was not declared in this scope
   42 |     answer(a, connected);
      |     ^~~~~~
cave.cpp: In function 'int f(int, int)':
cave.cpp:27:6: warning: control reaches end of non-void function [-Wreturn-type]
   27 |     f(l, r);
      |     ~^~~~~~