답안 #977477

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
977477 2024-05-08T03:57:33 Z SiliconSquared 드문 곤충 (IOI22_insects) C++17
25 / 100
190 ms 1128 KB
#include "insects.h"
using namespace std;
#include <vector>
int min_cardinality(int N) {
    int a,b,c,q;
    vector<bool> g;
    vector<bool> h;
    bool f;
    g.resize(N,false);
    h.resize(N);
    for (int i=0;i<N;i++){
        move_inside(i);
    }
    b=press_button();
    for (int i=0;i<N;i++){
        move_outside(i);
    }
    a=1;
    while (a!=b){
        c=(a+b)/2;
        for (int i=0;i<N;i++){h[i]=false;}
        for (int i=0;i<N;i++){
            if (!g[i]){
                move_inside(i);
                q=press_button();
                if (q>c){
                    move_outside(i);
                    h[i]=true;
                }
            }
        }
        for (int i=0;i<N;i++){
            if (!g[i]){
                if (!h[i]){
                    move_outside(i);
                }
            }
        }
        for (int i=0;i<N;i++){
            if (!g[i]){
                if (h[i]){
                    move_inside(i);
                    if (press_button()==2){
                        move_outside(i);
                    }
                }
            }
        }
        f=true;
        for (int i=0;i<N;i++){
            if ((!g[i])&&(!h[i])){
                move_inside(i);
                if (press_button()==2){
                    h[i]=true;
                }else{
                    f=false;
                }
                move_outside(i);
            }
        }
        if (f){
            //all bugs eliminated
            a=c+1;
        }else{
            //some bugs remain
            b=c;
            for (int i=0;i<N;i++){
                if (h[i]){
                    g[i]=true;
                }
            }
        }
    }
    return a;
}
# 결과 실행 시간 메모리 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 10 ms 596 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 6 ms 344 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 6 ms 500 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 2 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 7 ms 344 KB Output is correct
16 Correct 5 ms 344 KB Output is correct
17 Correct 2 ms 344 KB Output is correct
18 Correct 3 ms 344 KB Output is correct
19 Correct 3 ms 344 KB Output is correct
20 Correct 3 ms 344 KB Output is correct
21 Correct 3 ms 344 KB Output is correct
22 Correct 3 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 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 10 ms 596 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 6 ms 344 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 6 ms 500 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 2 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 7 ms 344 KB Output is correct
16 Correct 5 ms 344 KB Output is correct
17 Correct 2 ms 344 KB Output is correct
18 Correct 3 ms 344 KB Output is correct
19 Correct 3 ms 344 KB Output is correct
20 Correct 3 ms 344 KB Output is correct
21 Correct 3 ms 344 KB Output is correct
22 Correct 3 ms 344 KB Output is correct
23 Correct 85 ms 652 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 49 ms 652 KB Output is correct
26 Correct 13 ms 428 KB Output is correct
27 Correct 11 ms 344 KB Output is correct
28 Correct 45 ms 592 KB Output is correct
29 Correct 11 ms 848 KB Output is correct
30 Correct 10 ms 344 KB Output is correct
31 Correct 33 ms 592 KB Output is correct
32 Correct 38 ms 668 KB Output is correct
33 Correct 23 ms 836 KB Output is correct
34 Correct 36 ms 668 KB Output is correct
35 Correct 20 ms 592 KB Output is correct
36 Correct 24 ms 584 KB Output is correct
37 Correct 9 ms 592 KB Output is correct
38 Correct 16 ms 592 KB Output is correct
39 Correct 13 ms 344 KB Output is correct
40 Correct 22 ms 428 KB Output is correct
41 Correct 24 ms 664 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 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Partially correct 0 ms 344 KB Output is partially correct
6 Partially correct 1 ms 344 KB Output is partially correct
7 Incorrect 190 ms 1128 KB Too many queries.
8 Halted 0 ms 0 KB -