Submission #654951

#TimeUsernameProblemLanguageResultExecution timeMemory
654951sandry24Cave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> pi; #define pb push_back #define mp make_pair #define f first #define s second void exploreCave(int N){ vi s(N), d(N); vector<bool> checked(N); for(int i = 0; i < N; i++){ int l = 0, r = N-1; int f_ans = try_combination(s); while(l != r){ vi temp = s; int mid = (l+r)/2; for(int j = l; j <= mid; j++){ if(checked[j]) continue; temp[j] = !s[j]; } int ans = try_combination(temp); if(ans != f_ans) r = mid; else l = mid+1; } d[i] = l; checked[l] = 1; if(f_ans == i) s[l] == !s[l]; } answer(s, d); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:18:21: error: 'try_combination' was not declared in this scope; did you mean 'tryCombination'?
   18 |         int f_ans = try_combination(s);
      |                     ^~~~~~~~~~~~~~~
      |                     tryCombination
cave.cpp:36:18: warning: value computed is not used [-Wunused-value]
   36 |             s[l] == !s[l];
cave.cpp:11:11: error: cannot convert 'vi' {aka 'std::vector<int>'} to 'int*'
   11 | #define s second
      |           ^~~~~~
      |           |
      |           vi {aka std::vector<int>}
cave.cpp:38:12: note: in expansion of macro 's'
   38 |     answer(s, d);
      |            ^
In file included from cave.cpp:2:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~