This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#include "insects.h"
using namespace std;
int min_cardinality(int n)
{
    for(int i =0;i<n;i++)
    {
        move_inside(i);
    }
     int high=press_button();
    for(int i=0;i<n;i++) move_outside(i);
    int low=1;
    int mid;
    bool inside[n];
    for(int i=0;i<n;i++)
    {
        inside[i]=0;
    }
    while(low<high)
    {
        mid=(low+high)/2;
        int added=0;
        for(int i=0;i<n;i++)
        {
            if(!inside[i])
            {
                move_inside(i);
                inside[i]=1;
                int tp=press_button();
                added++;
                if(tp>mid)
                {
                    inside[i]=0;
                    added--;
                    move_outside(i);
                }
            }
        }
        if(added%mid==0)
        {
            low=mid+1;
        }else
        {
            high=mid;
            for(int i=0;i<n;i++)
            {
                inside[i]=0;
                move_outside(i);
            }
        }
    }
    return high;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... | 
| # | Verdict | Execution time | Memory | Grader output | 
|---|
| Fetching results... |