답안 #1025069

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1025069 2024-07-16T15:26:14 Z vjudge1 드문 곤충 (IOI22_insects) C++17
47.51 / 100
179 ms 996 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);
            }
        }
    }
    for(int x:vec)move_outside(x);
    // if(sz(st)!=m*sz(a)){
    //     for(int x:vec)move_outside(x);
    // }
    // cout<<m<<" "<<sz(st)<<" "<<m*sz(a)<<"\n";
    // 0 33
    // 1 41
    // 2 40
    // 3 41
    // 4 45
    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);
        }
    }
    // check(32);
    // check(33);
    // check(34);
    // return 0;
    // cout<<sz(a)<<"\n";
    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 1 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 9 ms 448 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
8 Correct 5 ms 444 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Correct 10 ms 344 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 9 ms 344 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 5 ms 444 KB Output is correct
16 Correct 4 ms 344 KB Output is correct
17 Correct 4 ms 344 KB Output is correct
18 Correct 6 ms 344 KB Output is correct
19 Correct 5 ms 344 KB Output is correct
20 Correct 4 ms 344 KB Output is correct
21 Correct 3 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 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 344 KB Output is correct
6 Correct 9 ms 448 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
8 Correct 5 ms 444 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Correct 10 ms 344 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 9 ms 344 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 5 ms 444 KB Output is correct
16 Correct 4 ms 344 KB Output is correct
17 Correct 4 ms 344 KB Output is correct
18 Correct 6 ms 344 KB Output is correct
19 Correct 5 ms 344 KB Output is correct
20 Correct 4 ms 344 KB Output is correct
21 Correct 3 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 79 ms 460 KB Output is correct
24 Correct 6 ms 600 KB Output is correct
25 Correct 40 ms 460 KB Output is correct
26 Correct 33 ms 452 KB Output is correct
27 Correct 59 ms 344 KB Output is correct
28 Correct 9 ms 696 KB Output is correct
29 Correct 48 ms 600 KB Output is correct
30 Correct 33 ms 344 KB Output is correct
31 Correct 40 ms 452 KB Output is correct
32 Correct 53 ms 600 KB Output is correct
33 Correct 59 ms 684 KB Output is correct
34 Correct 42 ms 344 KB Output is correct
35 Correct 37 ms 688 KB Output is correct
36 Correct 45 ms 432 KB Output is correct
37 Correct 32 ms 620 KB Output is correct
38 Correct 24 ms 344 KB Output is correct
39 Correct 28 ms 344 KB Output is correct
40 Correct 11 ms 344 KB Output is correct
41 Correct 10 ms 600 KB Output is correct
# 결과 실행 시간 메모리 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 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Partially correct 0 ms 344 KB Output is partially correct
7 Partially correct 179 ms 752 KB Output is partially correct
8 Correct 10 ms 444 KB Output is correct
9 Partially correct 103 ms 704 KB Output is partially correct
10 Partially correct 81 ms 412 KB Output is partially correct
11 Partially correct 144 ms 408 KB Output is partially correct
12 Correct 28 ms 600 KB Output is correct
13 Partially correct 107 ms 344 KB Output is partially correct
14 Partially correct 66 ms 344 KB Output is partially correct
15 Partially correct 129 ms 592 KB Output is partially correct
16 Partially correct 131 ms 460 KB Output is partially correct
17 Partially correct 131 ms 684 KB Output is partially correct
18 Partially correct 114 ms 888 KB Output is partially correct
19 Partially correct 123 ms 732 KB Output is partially correct
20 Partially correct 110 ms 956 KB Output is partially correct
21 Partially correct 76 ms 744 KB Output is partially correct
22 Partially correct 64 ms 664 KB Output is partially correct
23 Partially correct 42 ms 600 KB Output is partially correct
24 Correct 23 ms 668 KB Output is correct
25 Correct 25 ms 856 KB Output is correct
26 Correct 14 ms 444 KB Output is correct
27 Partially correct 88 ms 724 KB Output is partially correct
28 Partially correct 109 ms 716 KB Output is partially correct
29 Partially correct 109 ms 716 KB Output is partially correct
30 Partially correct 92 ms 508 KB Output is partially correct
31 Partially correct 71 ms 712 KB Output is partially correct
32 Partially correct 69 ms 868 KB Output is partially correct
33 Partially correct 48 ms 344 KB Output is partially correct
34 Partially correct 59 ms 428 KB Output is partially correct
35 Partially correct 89 ms 660 KB Output is partially correct
36 Partially correct 94 ms 744 KB Output is partially correct
37 Partially correct 74 ms 596 KB Output is partially correct
38 Partially correct 66 ms 996 KB Output is partially correct
39 Partially correct 88 ms 740 KB Output is partially correct
40 Partially correct 66 ms 736 KB Output is partially correct
41 Partially correct 98 ms 712 KB Output is partially correct
42 Partially correct 85 ms 760 KB Output is partially correct
43 Partially correct 14 ms 344 KB Output is partially correct
44 Partially correct 90 ms 344 KB Output is partially correct
45 Partially correct 155 ms 852 KB Output is partially correct
46 Correct 24 ms 344 KB Output is correct
47 Correct 22 ms 344 KB Output is correct
48 Correct 28 ms 432 KB Output is correct