Submission #859332

# Submission time Handle Problem Language Result Execution time Memory
859332 2023-10-10T04:16:26 Z imarn Rarest Insects (IOI22_insects) C++17
0 / 100
1 ms 596 KB
#include<bits/stdc++.h>
#include "insects.h"
#define f first
#define s second
#define pb push_back
using namespace std;
int siz[2001]{0};
int min_cardinality(int N) {
    vector<int>vec;
    int vis[2001]={0};
    move_inside(0);
    int sz=0;
    for(int i=0;i<N;i++)siz[i]=1;
    for(int i=0;i<N;i++){
    	if(vis[i])continue;
        move_inside(i);
        if(press_button()==1){
            vis[i]=1;sz++;vec.pb(i);
        }
        else move_outside(i);
    }
    int l=1,r=N;
    int ans=1;
    int memsize=sz;
    while(l<r){
        int m=(l+r+1)>>1;
        int cnt=0;
        for(int i=0;i<N;i++){
            if(!vis[i]){
                move_inside(i);
                if(press_button()<=m){
                    cnt++;vis[i]=2;
                }
                else move_outside(i);
            }
        }
        if(cnt/memsize<m-ans)r=m-1;
        else l=m,ans=m;
    }return l;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 1 ms 344 KB Wrong answer.
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 1 ms 344 KB Wrong answer.
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 596 KB Output is correct
6 Incorrect 0 ms 344 KB Wrong answer.
7 Halted 0 ms 0 KB -