답안 #956901

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
956901 2024-04-02T16:04:41 Z n1k 드문 곤충 (IOI22_insects) C++17
53.16 / 100
116 ms 1884 KB
#include "insects.h"
#include <bits/stdc++.h>

using namespace std;

int n;

int min_cardinality(int N) {
	n = N;

	vector<int> v;
	set<int> 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.insert(i);
		}
	}

	mt19937 mt(4732012);
	int lb = 0, rb = n / v.size();
	while(lb<rb){
		int mb = (lb+rb+1)/2;

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

		for(auto x:order){
			if(v.size()*mb==in.size())
				break;

			out.extract(x);
			in.insert(x);
			move_inside(x);

			if(press_button()>mb+1){
				move_outside(x);
				in.extract(x);
				out.insert(x);
			}
		}

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

	return lb+1;
}
# 결과 실행 시간 메모리 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 3 ms 456 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 600 KB Output is correct
9 Correct 3 ms 444 KB Output is correct
10 Correct 7 ms 344 KB Output is correct
11 Correct 2 ms 600 KB Output is correct
12 Correct 6 ms 600 KB Output is correct
13 Correct 4 ms 856 KB Output is correct
14 Correct 3 ms 600 KB Output is correct
15 Correct 3 ms 600 KB Output is correct
16 Correct 3 ms 604 KB Output is correct
17 Correct 3 ms 600 KB Output is correct
18 Correct 4 ms 856 KB Output is correct
19 Correct 3 ms 344 KB Output is correct
20 Correct 3 ms 344 KB Output is correct
21 Correct 2 ms 600 KB Output is correct
22 Correct 1 ms 600 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 3 ms 456 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 600 KB Output is correct
9 Correct 3 ms 444 KB Output is correct
10 Correct 7 ms 344 KB Output is correct
11 Correct 2 ms 600 KB Output is correct
12 Correct 6 ms 600 KB Output is correct
13 Correct 4 ms 856 KB Output is correct
14 Correct 3 ms 600 KB Output is correct
15 Correct 3 ms 600 KB Output is correct
16 Correct 3 ms 604 KB Output is correct
17 Correct 3 ms 600 KB Output is correct
18 Correct 4 ms 856 KB Output is correct
19 Correct 3 ms 344 KB Output is correct
20 Correct 3 ms 344 KB Output is correct
21 Correct 2 ms 600 KB Output is correct
22 Correct 1 ms 600 KB Output is correct
23 Correct 10 ms 856 KB Output is correct
24 Correct 5 ms 600 KB Output is correct
25 Correct 15 ms 856 KB Output is correct
26 Correct 31 ms 1112 KB Output is correct
27 Correct 59 ms 1124 KB Output is correct
28 Correct 7 ms 1204 KB Output is correct
29 Correct 50 ms 1112 KB Output is correct
30 Correct 30 ms 592 KB Output is correct
31 Correct 15 ms 1624 KB Output is correct
32 Correct 23 ms 1368 KB Output is correct
33 Correct 23 ms 976 KB Output is correct
34 Correct 17 ms 860 KB Output is correct
35 Correct 16 ms 1376 KB Output is correct
36 Correct 17 ms 600 KB Output is correct
37 Correct 20 ms 644 KB Output is correct
38 Correct 15 ms 1112 KB Output is correct
39 Correct 13 ms 680 KB Output is correct
40 Correct 6 ms 616 KB Output is correct
41 Correct 6 ms 856 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 520 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 0 ms 344 KB Output is correct
7 Correct 20 ms 1112 KB Output is correct
8 Correct 8 ms 700 KB Output is correct
9 Correct 26 ms 1412 KB Output is correct
10 Partially correct 40 ms 1884 KB Output is partially correct
11 Partially correct 116 ms 1368 KB Output is partially correct
12 Correct 17 ms 856 KB Output is correct
13 Partially correct 105 ms 1480 KB Output is partially correct
14 Partially correct 62 ms 1248 KB Output is partially correct
15 Partially correct 59 ms 1460 KB Output is partially correct
16 Partially correct 56 ms 964 KB Output is partially correct
17 Partially correct 58 ms 856 KB Output is partially correct
18 Partially correct 49 ms 1112 KB Output is partially correct
19 Partially correct 44 ms 988 KB Output is partially correct
20 Partially correct 55 ms 768 KB Output is partially correct
21 Partially correct 57 ms 1388 KB Output is partially correct
22 Partially correct 40 ms 1380 KB Output is partially correct
23 Partially correct 41 ms 1468 KB Output is partially correct
24 Correct 33 ms 1116 KB Output is correct
25 Correct 12 ms 1120 KB Output is correct
26 Correct 13 ms 600 KB Output is correct
27 Correct 29 ms 748 KB Output is correct
28 Correct 25 ms 1484 KB Output is correct
29 Correct 21 ms 1404 KB Output is correct
30 Correct 20 ms 1368 KB Output is correct
31 Partially correct 39 ms 956 KB Output is partially correct
32 Partially correct 43 ms 1372 KB Output is partially correct
33 Partially correct 43 ms 1004 KB Output is partially correct
34 Partially correct 45 ms 1160 KB Output is partially correct
35 Correct 27 ms 1140 KB Output is correct
36 Correct 25 ms 1148 KB Output is correct
37 Partially correct 51 ms 1076 KB Output is partially correct
38 Partially correct 57 ms 1080 KB Output is partially correct
39 Correct 27 ms 856 KB Output is correct
40 Correct 31 ms 1244 KB Output is correct
41 Correct 30 ms 912 KB Output is correct
42 Correct 38 ms 1480 KB Output is correct
43 Partially correct 18 ms 1112 KB Output is partially correct
44 Partially correct 90 ms 1112 KB Output is partially correct
45 Correct 22 ms 1520 KB Output is correct
46 Correct 14 ms 856 KB Output is correct
47 Correct 16 ms 952 KB Output is correct
48 Correct 13 ms 600 KB Output is correct