Submission #815189

#TimeUsernameProblemLanguageResultExecution timeMemory
815189JakobZorzRarest Insects (IOI22_insects)C++17
Compilation error
0 ms0 KiB
#include"insects.h" #include<iostream> #include<vector> #include<set> using namespace std; set<int>inside; int n,distinct; int low_bound,high_bound; int c_press_button(){ return press_button(); } void c_move_inside(int a){ inside.insert(a); move_inside(a); } void c_move_outside(int a){ inside.erase(a); move_outside(a); } void check(int c){ for(int i=0;i<n;i++){ c_move_inside(i); if(c_press_button()>c) c_move_outside(i); } bool res=inside.size()==c*distinct; if(res){ low_bound=max(low_bound,c); high_bound=min(high_bound,c+(n-c*distinct)/distinct+1); }else{ low_bound=max(low_bound,0); high_bound=min(high_bound,c_press_button()); } vector<int>inside_vec={inside.begin(),inside.end()}; for(int i:inside_vec) c_move_outside(i); } int get_distinct(){ for(int i=0;i<n;i++){ c_move_inside(i); if(c_press_button()>1) c_move_outside(i); } int res=inside.size(); vector<int>inside_vec={inside.begin(),inside.end()}; for(int i:inside_vec) c_move_outside(i); return res; } int min_cardinality(int N){ n=N; distinct=get_distinct(); if(distinct>n/2) return 1; if(distinct==1) return n; low_bound=1; high_bound=n/distinct+1; while(low_bound<high_bound-1){ int m=(low_bound+high_bound)/2; check(m); } return l; }

Compilation message (stderr)

insects.cpp: In function 'void check(int)':
insects.cpp:32:27: warning: comparison of integer expressions of different signedness: 'std::set<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   32 |     bool res=inside.size()==c*distinct;
      |              ~~~~~~~~~~~~~^~~~~~~~~~~~
insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:77:12: error: 'l' was not declared in this scope
   77 |     return l;
      |            ^