Submission #1266575

#TimeUsernameProblemLanguageResultExecution timeMemory
1266575scalifrastico_098Rarest Insects (IOI22_insects)C++20
0 / 100
3 ms468 KiB
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
int m, op=0, c=0, pk=0; vector<bool> fg; vector<int> uh;
bool f1(int n)
{
  for(int i=0; i<n; i++){move_outside(i);} int lk=0;
  for(int i=0; i<m; i++)
  {
    int uj=press_button(), ok=0; 
    for(int j=0; j<n; j++)
    {
      move_inside(j); int no=press_button(); 
      if(no==uj)move_inside(j); else{uj=no; lk++; ok++; if(lk==n) return true;}
    }
    if(ok==0) break; 
  }
  return (lk==n);
} 
int min_cardinality(int n) { 
  int l=1, r=n, q=0;
  while (l<=n) 
  {
    m = (l+r)/2;if (f1(n)){ r=m-1;q=m;} else l=m+1;            
  }
  return q;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...