답안 #956894

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
956894 2024-04-02T15:57:00 Z n1k 드문 곤충 (IOI22_insects) C++17
47.51 / 100
131 ms 1768 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);
		}
	}

	int lb = 0, rb = n / v.size();
	while(lb<rb){
		int mb = (lb+rb+1)/2;
		for(auto x:out){
			move_inside(x);
			in.insert(x);
			if(press_button()>mb+1){
				move_outside(x);
				in.extract(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 1 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 8 ms 856 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 5 ms 452 KB Output is correct
9 Correct 5 ms 448 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 604 KB Output is correct
13 Correct 4 ms 344 KB Output is correct
14 Correct 5 ms 600 KB Output is correct
15 Correct 5 ms 600 KB Output is correct
16 Correct 6 ms 856 KB Output is correct
17 Correct 5 ms 952 KB Output is correct
18 Correct 4 ms 344 KB Output is correct
19 Correct 4 ms 600 KB Output is correct
20 Correct 3 ms 1112 KB Output is correct
21 Correct 2 ms 440 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 8 ms 856 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 5 ms 452 KB Output is correct
9 Correct 5 ms 448 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 604 KB Output is correct
13 Correct 4 ms 344 KB Output is correct
14 Correct 5 ms 600 KB Output is correct
15 Correct 5 ms 600 KB Output is correct
16 Correct 6 ms 856 KB Output is correct
17 Correct 5 ms 952 KB Output is correct
18 Correct 4 ms 344 KB Output is correct
19 Correct 4 ms 600 KB Output is correct
20 Correct 3 ms 1112 KB Output is correct
21 Correct 2 ms 440 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 49 ms 1368 KB Output is correct
24 Correct 5 ms 856 KB Output is correct
25 Correct 32 ms 1168 KB Output is correct
26 Correct 30 ms 1208 KB Output is correct
27 Correct 48 ms 600 KB Output is correct
28 Correct 8 ms 608 KB Output is correct
29 Correct 49 ms 600 KB Output is correct
30 Correct 32 ms 856 KB Output is correct
31 Correct 46 ms 916 KB Output is correct
32 Correct 35 ms 1380 KB Output is correct
33 Correct 43 ms 1504 KB Output is correct
34 Correct 35 ms 1148 KB Output is correct
35 Correct 31 ms 896 KB Output is correct
36 Correct 34 ms 1368 KB Output is correct
37 Correct 27 ms 1132 KB Output is correct
38 Correct 16 ms 856 KB Output is correct
39 Correct 12 ms 856 KB Output is correct
40 Correct 7 ms 952 KB Output is correct
41 Correct 5 ms 868 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 500 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 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 Partially correct 131 ms 1076 KB Output is partially correct
8 Correct 11 ms 856 KB Output is correct
9 Partially correct 68 ms 1440 KB Output is partially correct
10 Partially correct 65 ms 920 KB Output is partially correct
11 Partially correct 118 ms 1132 KB Output is partially correct
12 Correct 18 ms 1472 KB Output is correct
13 Partially correct 93 ms 1400 KB Output is partially correct
14 Partially correct 61 ms 1372 KB Output is partially correct
15 Partially correct 105 ms 1504 KB Output is partially correct
16 Partially correct 104 ms 1372 KB Output is partially correct
17 Partially correct 84 ms 1520 KB Output is partially correct
18 Partially correct 93 ms 980 KB Output is partially correct
19 Partially correct 96 ms 816 KB Output is partially correct
20 Partially correct 77 ms 1036 KB Output is partially correct
21 Partially correct 59 ms 1372 KB Output is partially correct
22 Partially correct 58 ms 864 KB Output is partially correct
23 Partially correct 36 ms 1148 KB Output is partially correct
24 Correct 29 ms 1368 KB Output is correct
25 Correct 16 ms 1204 KB Output is correct
26 Correct 11 ms 1192 KB Output is correct
27 Partially correct 79 ms 1208 KB Output is partially correct
28 Partially correct 87 ms 1404 KB Output is partially correct
29 Partially correct 73 ms 1220 KB Output is partially correct
30 Partially correct 74 ms 1472 KB Output is partially correct
31 Partially correct 79 ms 860 KB Output is partially correct
32 Partially correct 82 ms 1024 KB Output is partially correct
33 Partially correct 43 ms 1368 KB Output is partially correct
34 Partially correct 47 ms 712 KB Output is partially correct
35 Partially correct 59 ms 1536 KB Output is partially correct
36 Partially correct 52 ms 1664 KB Output is partially correct
37 Partially correct 61 ms 1036 KB Output is partially correct
38 Partially correct 69 ms 1768 KB Output is partially correct
39 Partially correct 61 ms 1220 KB Output is partially correct
40 Partially correct 49 ms 1376 KB Output is partially correct
41 Partially correct 75 ms 1064 KB Output is partially correct
42 Partially correct 71 ms 1456 KB Output is partially correct
43 Partially correct 17 ms 856 KB Output is partially correct
44 Partially correct 89 ms 1136 KB Output is partially correct
45 Partially correct 116 ms 1644 KB Output is partially correct
46 Correct 13 ms 1112 KB Output is correct
47 Correct 17 ms 860 KB Output is correct
48 Correct 13 ms 1108 KB Output is correct