Submission #867571

# Submission time Handle Problem Language Result Execution time Memory
867571 2023-10-28T19:46:10 Z imarn Rarest Insects (IOI22_insects) C++17
0 / 100
3 ms 428 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/sz;
    int mx=sz;
    int ans=1;
    while(l<r){
        int m=(l+r+1)>>1;
        int cnt=0;
        for(int i=0;i<N;i++){
            if(cnt==mx*(m-ans))break;
            if(!vis[i]){
                move_inside(i);
                if(press_button()<=m)cnt++,vis[i]=2;
                else move_outside(i),vis[i]=3;
            }
        }
        if(cnt==mx*(m-ans)){
            l=m;ans=m;
            for(int i=0;i<N;i++)if(vis[i]==2)vis[i]=vis[i]?0:1;
            for(int i=0;i<N;i++)if(vis[i]==3)vis[i]=vis[i]?0:1;
        }
        else {
            r=m-1;
            for(int i=0;i<N;i++)if(vis[i]==2){
                vis[i]=0;move_outside(i);
            }
        }
    }return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 428 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Incorrect 2 ms 344 KB Wrong answer.
15 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 428 KB Output is correct
9 Correct 2 ms 344 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Incorrect 2 ms 344 KB Wrong answer.
15 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 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Incorrect 1 ms 344 KB Wrong answer.
7 Halted 0 ms 0 KB -