답안 #977605

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
977605 2024-05-08T07:30:27 Z Vedang1006 드문 곤충 (IOI22_insects) C++17
47.52 / 100
128 ms 1088 KB
#include <bits/stdc++.h>
#include "insects.h"

using namespace std;

bool used[2000];
bool used2[2000];

void tryFillUsed2(int N, int target)
{
    for (int i = 0; i < N; i++)
    {
        if (!used[i])
        {
            move_inside(i);
            if (press_button() > target) move_outside(i);
            else
            {
                used2[i] = true;
            }
        }
    }
}

int min_cardinality(int N)
{
    int numberOfDistinctTypes = 0;

    for (int i = 0; i < N; i++)
    {
        move_inside(i);
        if (press_button() != 1) move_outside(i);
        else
        {
            numberOfDistinctTypes += 1;
            used[i] = true;
        }
    }

    int i = 1;

    for (int j = 1024; j > 0; j /= 2)
    {
        if (i + j <= 2000)
        {
            tryFillUsed2(N, i + j);
            int totalSumUsed2 = 0;
            for (int i = 0; i < N; i++) totalSumUsed2 += used[i] + used2[i];

            if (numberOfDistinctTypes * (i + j) != totalSumUsed2)
            {
                for (int idx = 0; idx < N; idx++)
                {
                    if (used2[idx]) move_outside(idx);
                    used2[idx] = false;
                }
            }
            else
            {
                for (int idx = 0; idx < N; idx++)
                {
                    used[idx] |= used2[idx];
                    used2[idx] = false;
                }

                i += j;
            }
        }
    }

    return i;
}
# 결과 실행 시간 메모리 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 6 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 8 ms 344 KB Output is correct
9 Correct 8 ms 344 KB Output is correct
10 Correct 11 ms 344 KB Output is correct
11 Correct 5 ms 344 KB Output is correct
12 Correct 10 ms 344 KB Output is correct
13 Correct 9 ms 344 KB Output is correct
14 Correct 6 ms 344 KB Output is correct
15 Correct 6 ms 344 KB Output is correct
16 Correct 7 ms 344 KB Output is correct
17 Correct 8 ms 344 KB Output is correct
18 Correct 8 ms 344 KB Output is correct
19 Correct 8 ms 344 KB Output is correct
20 Correct 8 ms 344 KB Output is correct
21 Correct 5 ms 344 KB Output is correct
22 Correct 4 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 6 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 8 ms 344 KB Output is correct
9 Correct 8 ms 344 KB Output is correct
10 Correct 11 ms 344 KB Output is correct
11 Correct 5 ms 344 KB Output is correct
12 Correct 10 ms 344 KB Output is correct
13 Correct 9 ms 344 KB Output is correct
14 Correct 6 ms 344 KB Output is correct
15 Correct 6 ms 344 KB Output is correct
16 Correct 7 ms 344 KB Output is correct
17 Correct 8 ms 344 KB Output is correct
18 Correct 8 ms 344 KB Output is correct
19 Correct 8 ms 344 KB Output is correct
20 Correct 8 ms 344 KB Output is correct
21 Correct 5 ms 344 KB Output is correct
22 Correct 4 ms 344 KB Output is correct
23 Correct 18 ms 600 KB Output is correct
24 Correct 5 ms 344 KB Output is correct
25 Correct 33 ms 680 KB Output is correct
26 Correct 48 ms 668 KB Output is correct
27 Correct 54 ms 352 KB Output is correct
28 Correct 27 ms 344 KB Output is correct
29 Correct 47 ms 920 KB Output is correct
30 Correct 53 ms 844 KB Output is correct
31 Correct 30 ms 668 KB Output is correct
32 Correct 28 ms 664 KB Output is correct
33 Correct 30 ms 920 KB Output is correct
34 Correct 34 ms 440 KB Output is correct
35 Correct 40 ms 840 KB Output is correct
36 Correct 46 ms 600 KB Output is correct
37 Correct 45 ms 668 KB Output is correct
38 Correct 41 ms 848 KB Output is correct
39 Correct 44 ms 600 KB Output is correct
40 Correct 31 ms 668 KB Output is correct
41 Correct 23 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Partially correct 0 ms 344 KB Output is partially correct
3 Correct 0 ms 344 KB Output is correct
4 Partially correct 0 ms 344 KB Output is partially correct
5 Partially correct 0 ms 344 KB Output is partially correct
6 Partially correct 1 ms 344 KB Output is partially correct
7 Correct 26 ms 540 KB Output is correct
8 Correct 8 ms 344 KB Output is correct
9 Partially correct 66 ms 896 KB Output is partially correct
10 Partially correct 84 ms 592 KB Output is partially correct
11 Partially correct 128 ms 416 KB Output is partially correct
12 Partially correct 56 ms 444 KB Output is partially correct
13 Partially correct 104 ms 656 KB Output is partially correct
14 Partially correct 113 ms 416 KB Output is partially correct
15 Partially correct 51 ms 892 KB Output is partially correct
16 Partially correct 52 ms 832 KB Output is partially correct
17 Partially correct 61 ms 416 KB Output is partially correct
18 Partially correct 60 ms 1072 KB Output is partially correct
19 Partially correct 74 ms 652 KB Output is partially correct
20 Partially correct 67 ms 660 KB Output is partially correct
21 Partially correct 88 ms 896 KB Output is partially correct
22 Partially correct 107 ms 904 KB Output is partially correct
23 Partially correct 106 ms 664 KB Output is partially correct
24 Partially correct 92 ms 912 KB Output is partially correct
25 Partially correct 59 ms 912 KB Output is partially correct
26 Partially correct 45 ms 916 KB Output is partially correct
27 Partially correct 83 ms 664 KB Output is partially correct
28 Partially correct 80 ms 432 KB Output is partially correct
29 Partially correct 79 ms 892 KB Output is partially correct
30 Partially correct 75 ms 832 KB Output is partially correct
31 Partially correct 102 ms 668 KB Output is partially correct
32 Partially correct 82 ms 1076 KB Output is partially correct
33 Partially correct 99 ms 664 KB Output is partially correct
34 Partially correct 110 ms 904 KB Output is partially correct
35 Partially correct 87 ms 672 KB Output is partially correct
36 Partially correct 93 ms 664 KB Output is partially correct
37 Partially correct 80 ms 840 KB Output is partially correct
38 Partially correct 95 ms 904 KB Output is partially correct
39 Partially correct 95 ms 1088 KB Output is partially correct
40 Partially correct 90 ms 920 KB Output is partially correct
41 Partially correct 63 ms 656 KB Output is partially correct
42 Partially correct 61 ms 652 KB Output is partially correct
43 Partially correct 27 ms 852 KB Output is partially correct
44 Partially correct 107 ms 668 KB Output is partially correct
45 Partially correct 33 ms 412 KB Output is partially correct
46 Partially correct 56 ms 592 KB Output is partially correct
47 Partially correct 60 ms 664 KB Output is partially correct
48 Partially correct 62 ms 412 KB Output is partially correct