Submission #1074433

# Submission time Handle Problem Language Result Execution time Memory
1074433 2024-08-25T10:31:06 Z Nicolaikrob Rarest Insects (IOI22_insects) C++17
47.51 / 100
175 ms 1080 KB
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;

int tc, n;
vi M, IS;

void mi(int i) {
    move_inside(IS[i]);
    M.push_back(IS[i]);
}

void mo(int i = 0) {
    move_outside(M.back());
    M.pop_back();
}

bool tjek(int g) {
    int ctr = n;
    while(M.size() > 1) mo();
    for(int i = 1; i < n; i++) {
        mi(i);
        if(press_button() > g) ctr--, mo(i);
    }
    return (ctr == g*tc);
}

int min_cardinality(int N) {
	tc = n = N;
    IS.resize(n);
    for(int i = 0; i < n; i++) IS[i] = i;
    srand(time(NULL));
    random_shuffle(IS.begin(), IS.end());
    mi(0);
    for(int i = 1; i < n; i++) {
        mi(i);
        if(press_button() > 1) tc--, mo(i);
    }
    int l = 1, u = n;
    while(l < u) {
        int g = (l+u+1)/2;
        if(tjek(g)) l = g;
        else u = g-1;
    }
    return l;
}
# Verdict Execution time Memory 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 1 ms 344 KB Output is correct
6 Correct 11 ms 344 KB Output is correct
7 Correct 8 ms 344 KB Output is correct
8 Correct 11 ms 344 KB Output is correct
9 Correct 9 ms 344 KB Output is correct
10 Correct 9 ms 344 KB Output is correct
11 Correct 8 ms 344 KB Output is correct
12 Correct 8 ms 600 KB Output is correct
13 Correct 6 ms 344 KB Output is correct
14 Correct 10 ms 344 KB Output is correct
15 Correct 14 ms 344 KB Output is correct
16 Correct 9 ms 436 KB Output is correct
17 Correct 10 ms 344 KB Output is correct
18 Correct 7 ms 344 KB Output is correct
19 Correct 11 ms 344 KB Output is correct
20 Correct 7 ms 344 KB Output is correct
21 Correct 7 ms 600 KB Output is correct
22 Correct 9 ms 344 KB Output is correct
# Verdict Execution time Memory 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 1 ms 344 KB Output is correct
6 Correct 11 ms 344 KB Output is correct
7 Correct 8 ms 344 KB Output is correct
8 Correct 11 ms 344 KB Output is correct
9 Correct 9 ms 344 KB Output is correct
10 Correct 9 ms 344 KB Output is correct
11 Correct 8 ms 344 KB Output is correct
12 Correct 8 ms 600 KB Output is correct
13 Correct 6 ms 344 KB Output is correct
14 Correct 10 ms 344 KB Output is correct
15 Correct 14 ms 344 KB Output is correct
16 Correct 9 ms 436 KB Output is correct
17 Correct 10 ms 344 KB Output is correct
18 Correct 7 ms 344 KB Output is correct
19 Correct 11 ms 344 KB Output is correct
20 Correct 7 ms 344 KB Output is correct
21 Correct 7 ms 600 KB Output is correct
22 Correct 9 ms 344 KB Output is correct
23 Correct 80 ms 344 KB Output is correct
24 Correct 70 ms 344 KB Output is correct
25 Correct 66 ms 344 KB Output is correct
26 Correct 62 ms 344 KB Output is correct
27 Correct 59 ms 344 KB Output is correct
28 Correct 83 ms 432 KB Output is correct
29 Correct 78 ms 416 KB Output is correct
30 Correct 62 ms 600 KB Output is correct
31 Correct 85 ms 436 KB Output is correct
32 Correct 76 ms 344 KB Output is correct
33 Correct 74 ms 440 KB Output is correct
34 Correct 72 ms 344 KB Output is correct
35 Correct 70 ms 600 KB Output is correct
36 Correct 74 ms 444 KB Output is correct
37 Correct 62 ms 340 KB Output is correct
38 Correct 57 ms 344 KB Output is correct
39 Correct 86 ms 600 KB Output is correct
40 Correct 58 ms 344 KB Output is correct
41 Correct 62 ms 344 KB Output is correct
# Verdict Execution time Memory 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 Partially correct 1 ms 344 KB Output is partially correct
7 Partially correct 175 ms 440 KB Output is partially correct
8 Partially correct 113 ms 680 KB Output is partially correct
9 Partially correct 163 ms 436 KB Output is partially correct
10 Partially correct 156 ms 680 KB Output is partially correct
11 Partially correct 160 ms 428 KB Output is partially correct
12 Partially correct 145 ms 600 KB Output is partially correct
13 Partially correct 149 ms 440 KB Output is partially correct
14 Partially correct 143 ms 436 KB Output is partially correct
15 Partially correct 142 ms 932 KB Output is partially correct
16 Partially correct 144 ms 684 KB Output is partially correct
17 Partially correct 115 ms 688 KB Output is partially correct
18 Partially correct 128 ms 620 KB Output is partially correct
19 Partially correct 146 ms 892 KB Output is partially correct
20 Partially correct 158 ms 924 KB Output is partially correct
21 Partially correct 142 ms 1080 KB Output is partially correct
22 Partially correct 152 ms 680 KB Output is partially correct
23 Partially correct 146 ms 920 KB Output is partially correct
24 Partially correct 141 ms 956 KB Output is partially correct
25 Partially correct 158 ms 664 KB Output is partially correct
26 Partially correct 118 ms 704 KB Output is partially correct
27 Partially correct 167 ms 680 KB Output is partially correct
28 Partially correct 163 ms 676 KB Output is partially correct
29 Partially correct 128 ms 680 KB Output is partially correct
30 Partially correct 171 ms 680 KB Output is partially correct
31 Partially correct 144 ms 684 KB Output is partially correct
32 Partially correct 130 ms 676 KB Output is partially correct
33 Partially correct 150 ms 676 KB Output is partially correct
34 Partially correct 167 ms 432 KB Output is partially correct
35 Partially correct 117 ms 696 KB Output is partially correct
36 Partially correct 151 ms 900 KB Output is partially correct
37 Partially correct 134 ms 440 KB Output is partially correct
38 Partially correct 148 ms 688 KB Output is partially correct
39 Partially correct 161 ms 848 KB Output is partially correct
40 Partially correct 147 ms 444 KB Output is partially correct
41 Partially correct 146 ms 892 KB Output is partially correct
42 Partially correct 148 ms 920 KB Output is partially correct
43 Partially correct 24 ms 440 KB Output is partially correct
44 Partially correct 125 ms 436 KB Output is partially correct
45 Partially correct 151 ms 668 KB Output is partially correct
46 Partially correct 142 ms 688 KB Output is partially correct
47 Partially correct 121 ms 452 KB Output is partially correct
48 Partially correct 135 ms 600 KB Output is partially correct