Submission #831197

# Submission time Handle Problem Language Result Execution time Memory
831197 2023-08-19T21:57:36 Z tolbi Rarest Insects (IOI22_insects) C++17
47.5 / 100
176 ms 612 KB
#include <bits/stdc++.h>
using namespace std;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
#include "insects.h"
int min_cardinality(int n) {
	set<int> olan;
	for (int i = 0; i < n; ++i)
	{
		olan.insert(i);
	}
	vector<int> aldim;
	vector<int> almadim;
	function<int(int)> calc;
	calc = [&](int x)->int{
		aldim.clear();
		almadim.clear();
		int ans = 0;
		for (auto it : olan){
			move_inside(it);
			if (press_button()>x){
				move_outside(it);
				almadim.push_back(it);
			}
			else {
				aldim.push_back(it);
				ans++;
			}
		}
		for (auto &it : aldim){
			move_outside(it);
		}
		return ans;
	};
	int diff = calc(1);
	int l = 2, r = n+1;
	int hueh = 0;
	while (l<r){
		int mid = l+(r-l)/2;
		int crr = calc(mid-hueh);
		if (crr==(mid-hueh)*diff){
			l=mid+1;
			hueh=mid;
			while (aldim.size()){
				olan.erase(aldim.back());
				aldim.pop_back();
			}
		}
		else {
			r=mid;
			while (almadim.size()){
				olan.erase(almadim.back());
				almadim.pop_back();
			}
		}
	}
	return l-1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 4 ms 208 KB Output is correct
7 Correct 16 ms 208 KB Output is correct
8 Correct 9 ms 208 KB Output is correct
9 Correct 9 ms 208 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 8 ms 208 KB Output is correct
12 Correct 7 ms 208 KB Output is correct
13 Correct 14 ms 208 KB Output is correct
14 Correct 9 ms 208 KB Output is correct
15 Correct 9 ms 208 KB Output is correct
16 Correct 9 ms 208 KB Output is correct
17 Correct 8 ms 208 KB Output is correct
18 Correct 13 ms 208 KB Output is correct
19 Correct 10 ms 208 KB Output is correct
20 Correct 16 ms 208 KB Output is correct
21 Correct 9 ms 208 KB Output is correct
22 Correct 12 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 4 ms 208 KB Output is correct
7 Correct 16 ms 208 KB Output is correct
8 Correct 9 ms 208 KB Output is correct
9 Correct 9 ms 208 KB Output is correct
10 Correct 5 ms 208 KB Output is correct
11 Correct 8 ms 208 KB Output is correct
12 Correct 7 ms 208 KB Output is correct
13 Correct 14 ms 208 KB Output is correct
14 Correct 9 ms 208 KB Output is correct
15 Correct 9 ms 208 KB Output is correct
16 Correct 9 ms 208 KB Output is correct
17 Correct 8 ms 208 KB Output is correct
18 Correct 13 ms 208 KB Output is correct
19 Correct 10 ms 208 KB Output is correct
20 Correct 16 ms 208 KB Output is correct
21 Correct 9 ms 208 KB Output is correct
22 Correct 12 ms 208 KB Output is correct
23 Correct 21 ms 336 KB Output is correct
24 Correct 83 ms 360 KB Output is correct
25 Correct 72 ms 336 KB Output is correct
26 Correct 47 ms 356 KB Output is correct
27 Correct 25 ms 344 KB Output is correct
28 Correct 67 ms 336 KB Output is correct
29 Correct 24 ms 344 KB Output is correct
30 Correct 41 ms 352 KB Output is correct
31 Correct 28 ms 340 KB Output is correct
32 Correct 55 ms 368 KB Output is correct
33 Correct 49 ms 352 KB Output is correct
34 Correct 21 ms 348 KB Output is correct
35 Correct 44 ms 336 KB Output is correct
36 Correct 55 ms 356 KB Output is correct
37 Correct 53 ms 352 KB Output is correct
38 Correct 73 ms 352 KB Output is correct
39 Correct 69 ms 336 KB Output is correct
40 Correct 66 ms 344 KB Output is correct
41 Correct 76 ms 356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Partially correct 0 ms 208 KB Output is partially correct
6 Partially correct 0 ms 208 KB Output is partially correct
7 Correct 45 ms 396 KB Output is correct
8 Partially correct 173 ms 516 KB Output is partially correct
9 Partially correct 91 ms 408 KB Output is partially correct
10 Partially correct 84 ms 408 KB Output is partially correct
11 Partially correct 37 ms 400 KB Output is partially correct
12 Partially correct 140 ms 404 KB Output is partially correct
13 Partially correct 90 ms 400 KB Output is partially correct
14 Partially correct 84 ms 512 KB Output is partially correct
15 Partially correct 69 ms 400 KB Output is partially correct
16 Partially correct 78 ms 336 KB Output is partially correct
17 Partially correct 61 ms 544 KB Output is partially correct
18 Partially correct 73 ms 404 KB Output is partially correct
19 Partially correct 92 ms 396 KB Output is partially correct
20 Partially correct 67 ms 404 KB Output is partially correct
21 Partially correct 107 ms 400 KB Output is partially correct
22 Partially correct 125 ms 396 KB Output is partially correct
23 Partially correct 176 ms 400 KB Output is partially correct
24 Partially correct 141 ms 408 KB Output is partially correct
25 Partially correct 160 ms 408 KB Output is partially correct
26 Partially correct 141 ms 484 KB Output is partially correct
27 Partially correct 97 ms 396 KB Output is partially correct
28 Partially correct 112 ms 460 KB Output is partially correct
29 Partially correct 99 ms 396 KB Output is partially correct
30 Partially correct 82 ms 396 KB Output is partially correct
31 Partially correct 93 ms 612 KB Output is partially correct
32 Partially correct 97 ms 396 KB Output is partially correct
33 Partially correct 146 ms 436 KB Output is partially correct
34 Partially correct 168 ms 396 KB Output is partially correct
35 Partially correct 77 ms 400 KB Output is partially correct
36 Partially correct 82 ms 400 KB Output is partially correct
37 Partially correct 147 ms 396 KB Output is partially correct
38 Partially correct 99 ms 500 KB Output is partially correct
39 Partially correct 174 ms 408 KB Output is partially correct
40 Partially correct 118 ms 400 KB Output is partially correct
41 Partially correct 90 ms 412 KB Output is partially correct
42 Partially correct 123 ms 464 KB Output is partially correct
43 Partially correct 19 ms 332 KB Output is partially correct
44 Partially correct 47 ms 336 KB Output is partially correct
45 Partially correct 55 ms 404 KB Output is partially correct
46 Partially correct 107 ms 396 KB Output is partially correct
47 Partially correct 137 ms 392 KB Output is partially correct
48 Partially correct 129 ms 396 KB Output is partially correct