Submission #1070838

# Submission time Handle Problem Language Result Execution time Memory
1070838 2024-08-22T19:24:43 Z JoenPoenMan Rarest Insects (IOI22_insects) C++17
Compilation error
0 ms 0 KB
#include "insects.h"#include <bits/stdc++.h>using namespace std;int min_cardinality(int n) {  int k = 0;  vector<int> S;  for (int i = 0; i< n; i++) {      move_inside(i);      if (press_button() == 2) {          move_outside(i);      } else S.push_back(i);  }  k = S.size();      int _n = n, y = 0;  vector<bool> active(n, 1);  while (_n != 0) {      int x = (_n+2*k-1)/(2*k);      for (int i : S) move_outside(i);      S.clear();      for (int i = 0; i< n; i++) if (active[i]) {          move_inside(i);          if (press_button() == x+1) {              move_outside(i);          } else S.push_back(i);      }            if (S.size() < x*k) {          if (_n == 1) break;          active.assign(n, 0);          _n = 0;          for (int i : S) active[i] = 1, _n++;      } else {          for (int i : S) {              _n -= active[i];              active[i] = 0;          }          y += x;      }        }  return y;}

Compilation message

insects.cpp:1:21: warning: extra tokens at end of #include directive
    1 | #include "insects.h"#include <bits/stdc++.h>using namespace std;int min_cardinality(int n) {  int k = 0;  vector<int> S;  for (int i = 0; i< n; i++) {      move_inside(i);      if (press_button() == 2) {          move_outside(i);      } else S.push_back(i);  }  k = S.size();      int _n = n, y = 0;  vector<bool> active(n, 1);  while (_n != 0) {      int x = (_n+2*k-1)/(2*k);      for (int i : S) move_outside(i);      S.clear();      for (int i = 0; i< n; i++) if (active[i]) {          move_inside(i);          if (press_button() == x+1) {              move_outside(i);          } else S.push_back(i);      }            if (S.size() < x*k) {          if (_n == 1) break;          active.assign(n, 0);          _n = 0;          for (int i : S) active[i] = 1, _n++;      } else {          for (int i : S) {              _n -= active[i];              active[i] = 0;          }          y += x;      }        }  return y;}
      |                     ^
/usr/bin/ld: /tmp/ccxta1ya.o: in function `main':
stub.cpp:(.text.startup+0x61): undefined reference to `min_cardinality(int)'
collect2: error: ld returned 1 exit status