Submission #956911

# Submission time Handle Problem Language Result Execution time Memory
956911 2024-04-02T16:25:56 Z n1k Rarest Insects (IOI22_insects) C++17
89.47 / 100
49 ms 1116 KB
#include "insects.h"
#include <bits/stdc++.h>

using namespace std;

int n;

int min_cardinality(int N) {
	n = N;

	vector<int> v, in, out;

	for(int i=0; i<n; i++){
		move_inside(i);
		v.push_back(i);
		if(press_button()>=2){
			move_outside(i);
			v.pop_back();
			out.push_back(i);
		}
	}
	mt19937 mt(1234132);
	int lb = 0, rb = n / v.size();
	while(lb<rb){
		int mb = (lb+rb+1)/2;

		vector<int> nout;
		shuffle(out.begin(), out.end(), mt);

		for(auto x:out){
			if(v.size()*mb==in.size()){
				nout.push_back(x);
			}else{
				move_inside(x);
				if(press_button()>mb+1){
					move_outside(x);
					nout.push_back(x);
				}else{
					in.push_back(x);
				}
			}
		}

		if(v.size()*mb==in.size()){
			lb=mb;
			out=nout;
		}else{
			rb=mb-1;
			out = in;
			for(auto x:in) move_outside(x);
			in.clear();
		}
	}

	return lb+1;
}
# 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 0 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 2 ms 600 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 2 ms 600 KB Output is correct
12 Correct 2 ms 436 KB Output is correct
13 Correct 3 ms 600 KB Output is correct
14 Correct 4 ms 344 KB Output is correct
15 Correct 3 ms 344 KB Output is correct
16 Correct 3 ms 600 KB Output is correct
17 Correct 3 ms 344 KB Output is correct
18 Correct 2 ms 600 KB Output is correct
19 Correct 3 ms 344 KB Output is correct
20 Correct 2 ms 344 KB Output is correct
21 Correct 2 ms 344 KB Output is correct
22 Correct 2 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 0 ms 344 KB Output is correct
6 Correct 2 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 596 KB Output is correct
9 Correct 2 ms 600 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 2 ms 600 KB Output is correct
12 Correct 2 ms 436 KB Output is correct
13 Correct 3 ms 600 KB Output is correct
14 Correct 4 ms 344 KB Output is correct
15 Correct 3 ms 344 KB Output is correct
16 Correct 3 ms 600 KB Output is correct
17 Correct 3 ms 344 KB Output is correct
18 Correct 2 ms 600 KB Output is correct
19 Correct 3 ms 344 KB Output is correct
20 Correct 2 ms 344 KB Output is correct
21 Correct 2 ms 344 KB Output is correct
22 Correct 2 ms 344 KB Output is correct
23 Correct 12 ms 692 KB Output is correct
24 Correct 4 ms 344 KB Output is correct
25 Correct 11 ms 600 KB Output is correct
26 Correct 23 ms 928 KB Output is correct
27 Correct 14 ms 848 KB Output is correct
28 Correct 8 ms 856 KB Output is correct
29 Correct 13 ms 904 KB Output is correct
30 Correct 15 ms 604 KB Output is correct
31 Correct 14 ms 856 KB Output is correct
32 Correct 22 ms 680 KB Output is correct
33 Correct 20 ms 680 KB Output is correct
34 Correct 16 ms 604 KB Output is correct
35 Correct 13 ms 696 KB Output is correct
36 Correct 14 ms 848 KB Output is correct
37 Correct 19 ms 944 KB Output is correct
38 Correct 14 ms 700 KB Output is correct
39 Correct 11 ms 604 KB Output is correct
40 Correct 10 ms 600 KB Output is correct
41 Correct 6 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 596 KB Output is correct
7 Correct 19 ms 444 KB Output is correct
8 Correct 12 ms 856 KB Output is correct
9 Correct 26 ms 860 KB Output is correct
10 Correct 22 ms 600 KB Output is correct
11 Correct 26 ms 704 KB Output is correct
12 Correct 11 ms 696 KB Output is correct
13 Correct 25 ms 856 KB Output is correct
14 Correct 32 ms 852 KB Output is correct
15 Partially correct 47 ms 856 KB Output is partially correct
16 Partially correct 46 ms 956 KB Output is partially correct
17 Partially correct 44 ms 936 KB Output is partially correct
18 Partially correct 49 ms 680 KB Output is partially correct
19 Partially correct 33 ms 600 KB Output is partially correct
20 Partially correct 40 ms 688 KB Output is partially correct
21 Partially correct 47 ms 664 KB Output is partially correct
22 Correct 22 ms 600 KB Output is correct
23 Correct 30 ms 864 KB Output is correct
24 Correct 21 ms 612 KB Output is correct
25 Correct 19 ms 940 KB Output is correct
26 Correct 12 ms 852 KB Output is correct
27 Correct 23 ms 604 KB Output is correct
28 Correct 35 ms 852 KB Output is correct
29 Correct 23 ms 692 KB Output is correct
30 Correct 27 ms 936 KB Output is correct
31 Correct 40 ms 932 KB Output is correct
32 Correct 28 ms 856 KB Output is correct
33 Correct 35 ms 696 KB Output is correct
34 Correct 24 ms 600 KB Output is correct
35 Correct 21 ms 856 KB Output is correct
36 Correct 23 ms 1116 KB Output is correct
37 Partially correct 46 ms 1104 KB Output is partially correct
38 Partially correct 39 ms 928 KB Output is partially correct
39 Correct 21 ms 856 KB Output is correct
40 Correct 26 ms 700 KB Output is correct
41 Correct 22 ms 1108 KB Output is correct
42 Correct 26 ms 600 KB Output is correct
43 Correct 6 ms 600 KB Output is correct
44 Correct 19 ms 1104 KB Output is correct
45 Correct 21 ms 952 KB Output is correct
46 Correct 13 ms 596 KB Output is correct
47 Correct 11 ms 856 KB Output is correct
48 Correct 17 ms 604 KB Output is correct