답안 #1025050

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1025050 2024-07-16T14:51:47 Z vjudge1 드문 곤충 (IOI22_insects) C++17
0 / 100
141 ms 1008 KB
#include "insects.h"
#include <bits/stdc++.h>

#define ll long long
#define sz(s) (int)s.size()
#define pb push_back
#define in insert
#define lb lower_bound
#define ub upper_bound

using namespace std;

const int MAX=2e5+10;

int n;
vector<int> a;
set<int> st;

bool check(int m){
    st.clear();
    for(int x:a)st.in(x);
    vector<int> vec;
    for(int i=0;i<n;i++){
        if(!st.count(i)){
            move_inside(i);
            if(press_button()>m){
                move_outside(i);
            }
            else{
                st.in(i);
                vec.pb(i);
            }
        }
    }
    // if(sz(st)!=m*sz(a)){
    //     for(int x:vec)move_outside(x);
    // }
    return (sz(st)==m*sz(a));
}

int min_cardinality(int N){
    n=N;
    for(int i=0;i<N;i++){
        move_inside(i);
        if(press_button()==2){
            move_outside(i);
        }
        else{
            a.pb(i);
            st.in(i);
        }
    }
    int l=1,r=N/sz(a),res=1;
    while(l<=r){
        int m=(l+r)/2;
        if(check(m)){
            l=m+1;
            res=m;
        }
        else r=m-1;
    }
    return res;
}
# 결과 실행 시간 메모리 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 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
10 Correct 7 ms 344 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 8 ms 344 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Incorrect 5 ms 344 KB Wrong answer.
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 8 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
10 Correct 7 ms 344 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 8 ms 344 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Incorrect 5 ms 344 KB Wrong answer.
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Partially correct 1 ms 344 KB Output is partially correct
7 Partially correct 137 ms 1008 KB Output is partially correct
8 Correct 11 ms 344 KB Output is correct
9 Partially correct 73 ms 744 KB Output is partially correct
10 Partially correct 67 ms 592 KB Output is partially correct
11 Partially correct 141 ms 428 KB Output is partially correct
12 Correct 22 ms 344 KB Output is correct
13 Partially correct 99 ms 596 KB Output is partially correct
14 Partially correct 58 ms 344 KB Output is partially correct
15 Incorrect 96 ms 728 KB Wrong answer.
16 Halted 0 ms 0 KB -