Submission #708781

#TimeUsernameProblemLanguageResultExecution timeMemory
708781t6twotwoRarest Insects (IOI22_insects)C++17
Compilation error
0 ms0 KiB
#include "insects.h" #include <bits/stdc++.h> using namespace std; using ll = long long; int min_cardinality(int n) { vector<bool> in(n); for (int i = 0; i < n; i++) { move_inside(i); if (press_button() == 2) move_outside(i); else in[i] = 1; } int type = 0; vector<bool> blocked(n); for (int i = 0; i < n; i++) { if (in[i]) { type++; blocked[i] = 1; } } int lo = 1, hi = n / type, cnt = type; while (lo < hi) { int x = (lo + hi + 1) / 2, cnt = 0; for (int i = 0; i < n; i++) { if (blocked[i]) continue; move_inside(i); // if (cnt == x * type) continue; if (press_button() == x + 1) move_outside(i); else in[i] = 1, cnt++; } for (int i = 0; i < n; i++) { if (blocked[i]) continue; if (in[i]) { if (cnt == x * type) { blocked[i] = 1; } else { in[i] = 0; cnt--; move_outside(i); } } else if (cnt != x * type) { blocked[i] = 1; } } if (cnt == x * type) lo = x; else hi = cnt / type; } return lo + add; }

Compilation message (stderr)

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:47:17: error: 'add' was not declared in this scope; did you mean 'std::filesystem::perm_options::add'?
   47 |     return lo + add;
      |                 ^~~
      |                 std::filesystem::perm_options::add
In file included from /usr/include/c++/10/filesystem:44,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:129,
                 from insects.cpp:2:
/usr/include/c++/10/bits/fs_fwd.h:202:7: note: 'std::filesystem::perm_options::add' declared here
  202 |       add = 0x2,
      |       ^~~
insects.cpp:20:32: warning: unused variable 'cnt' [-Wunused-variable]
   20 |     int lo = 1, hi = n / type, cnt = type;
      |                                ^~~