Submission #798949

#TimeUsernameProblemLanguageResultExecution timeMemory
798949LIFRarest Insects (IOI22_insects)C++17
0 / 100
195 ms320 KiB
#include "insects.h" #include <vector> #include<bits/stdc++.h> using namespace std; bool vis[300005]; bool can[300005]; int k = 0; bool check(int now,int N) { //if(now == 1)return true; vector<int> vv; for(int i=0;i<=N-1;i++) { move_inside(i); if(press_button() > now + 1) { move_outside(i); vv.push_back(i); } } if(N-vv.size() < (now+1) * k)return true; return false; } int min_cardinality(int N) { int l = 1; vector<int> cnt; for(int i=0;i<=N-1;i++) { move_inside(i); if(press_button() >= 2)move_outside(i); else cnt.push_back(i); } for(int i=0;i<=N-1;i++)move_outside(i); k = cnt.size(); int r = (N+k-1)/k; int ans = N/k; while(l <= r) { int mid = (l+r)>>1; if(check(mid,N) == true) { r = mid-1; ans = mid; } else l = mid+1; } return ans; }

Compilation message (stderr)

insects.cpp: In function 'bool check(int, int)':
insects.cpp:21:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   21 |  if(N-vv.size() < (now+1) * k)return true;
      |     ~~~~~~~~~~~~^~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...