Submission #859278

# Submission time Handle Problem Language Result Execution time Memory
859278 2023-10-10T03:14:52 Z imarn Rarest Insects (IOI22_insects) C++17
0 / 100
1 ms 344 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;
    bool vis[2001]={0};
    move_inside(0);
    int sz=0;
    for(int i=0;i<N;i++)siz[i]=1;
    for(int i=1;i<N;i++){
        move_inside(i);
        if(press_button()==1){
            vis[i]=1;sz++;vec.pb(i);
        }
        else move_outside(i);
    }
    if(sz>sqrt(N)){
        int now=2;
        while(sz<N){
            for(int i=1;i<N;i++){
                if(vis[i])continue;
                move_inside(i);
                if(press_button()==now){
                    vis[i]=1;sz++;
                }
                else move_outside(i);
            }now++;
        }return now-1;
    }
    else {
        for(int i=0;i<N;i++)if(vis[i])move_outside(i);
        for(int i=0;i<N;i++){
            if(!vis[i]){
                move_inside(i);
                for(auto it : vec){
                    move_inside(it);
                    if(press_button()==2){
                        siz[it]++;
                        break;
                    }
                    else move_outside(it);
                }
            }
        }
        int ans=1e9;
        for(auto it : vec){
            ans=min(ans,siz[it]);
        }return ans;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Wrong answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Wrong answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong answer.
3 Halted 0 ms 0 KB -