Submission #859228

# Submission time Handle Problem Language Result Execution time Memory
859228 2023-10-10T02:02:27 Z MasterDobby Rarest Insects (IOI22_insects) C++17
0 / 100
0 ms 596 KB
#include <bits/stdc++.h>
#include "insects.h"
#define all(a) a.begin(),a.end()
#define pii pair<int,int>

using namespace std;
using ll = long long;

bitset<2020> ch;

int min_cardinality(int n){
    int cnt=1;
    ch[0]=1;
    move_inside(0);
    for(int i=1;i<n;i++){
        move_inside(i);
        int num=press_button();
        if(num==1){
            ch[i]=1;
            cnt++;
        }
        else{
            move_outside(i);
        }
    }
    int ans=1;
    for(int i=2;i<=sqrt(n);i++){
        int cnt2=0;
        for(int j=0;j<n;j++){
            if(cnt2==cnt) break;
            if(ch[j]) continue;
            move_inside(j);
            int num=press_button();
            if(num==i){
                ch[j]=1;
                cnt2++;
            }
            else{
                move_outside(j);
            }
        }
        if(cnt2!=cnt) break;
        ans=i;
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Wrong answer.
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 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 596 KB Wrong answer.
3 Halted 0 ms 0 KB -