답안 #956927

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
956927 2024-04-02T17:06:49 Z n1k 드문 곤충 (IOI22_insects) C++17
89.38 / 100
49 ms 1188 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(715082022);
	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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 352 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 600 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 2 ms 600 KB Output is correct
10 Correct 3 ms 600 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 2 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 3 ms 344 KB Output is correct
16 Correct 3 ms 340 KB Output is correct
17 Correct 3 ms 436 KB Output is correct
18 Correct 2 ms 344 KB Output is correct
19 Correct 3 ms 600 KB Output is correct
20 Correct 2 ms 344 KB Output is correct
21 Correct 2 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 352 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 600 KB Output is correct
7 Correct 1 ms 600 KB Output is correct
8 Correct 2 ms 344 KB Output is correct
9 Correct 2 ms 600 KB Output is correct
10 Correct 3 ms 600 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 2 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 3 ms 344 KB Output is correct
16 Correct 3 ms 340 KB Output is correct
17 Correct 3 ms 436 KB Output is correct
18 Correct 2 ms 344 KB Output is correct
19 Correct 3 ms 600 KB Output is correct
20 Correct 2 ms 344 KB Output is correct
21 Correct 2 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 8 ms 448 KB Output is correct
24 Correct 4 ms 856 KB Output is correct
25 Correct 10 ms 600 KB Output is correct
26 Correct 22 ms 600 KB Output is correct
27 Correct 12 ms 1108 KB Output is correct
28 Correct 6 ms 600 KB Output is correct
29 Correct 11 ms 852 KB Output is correct
30 Correct 12 ms 600 KB Output is correct
31 Correct 14 ms 688 KB Output is correct
32 Correct 22 ms 944 KB Output is correct
33 Correct 19 ms 944 KB Output is correct
34 Correct 14 ms 444 KB Output is correct
35 Correct 15 ms 856 KB Output is correct
36 Correct 14 ms 600 KB Output is correct
37 Correct 17 ms 856 KB Output is correct
38 Correct 11 ms 856 KB Output is correct
39 Correct 9 ms 600 KB Output is correct
40 Correct 6 ms 856 KB Output is correct
41 Correct 6 ms 600 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 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 1 ms 340 KB Output is correct
7 Correct 20 ms 600 KB Output is correct
8 Correct 7 ms 600 KB Output is correct
9 Correct 22 ms 856 KB Output is correct
10 Correct 21 ms 1108 KB Output is correct
11 Correct 26 ms 600 KB Output is correct
12 Correct 13 ms 856 KB Output is correct
13 Correct 24 ms 1104 KB Output is correct
14 Correct 32 ms 600 KB Output is correct
15 Partially correct 49 ms 696 KB Output is partially correct
16 Partially correct 43 ms 1104 KB Output is partially correct
17 Partially correct 35 ms 700 KB Output is partially correct
18 Partially correct 39 ms 1104 KB Output is partially correct
19 Partially correct 35 ms 1188 KB Output is partially correct
20 Partially correct 46 ms 856 KB Output is partially correct
21 Partially correct 41 ms 700 KB Output is partially correct
22 Correct 27 ms 704 KB Output is correct
23 Correct 29 ms 864 KB Output is correct
24 Correct 25 ms 856 KB Output is correct
25 Correct 15 ms 604 KB Output is correct
26 Correct 13 ms 852 KB Output is correct
27 Correct 25 ms 856 KB Output is correct
28 Correct 24 ms 940 KB Output is correct
29 Correct 21 ms 604 KB Output is correct
30 Correct 21 ms 856 KB Output is correct
31 Correct 23 ms 432 KB Output is correct
32 Correct 27 ms 604 KB Output is correct
33 Correct 28 ms 924 KB Output is correct
34 Correct 24 ms 864 KB Output is correct
35 Correct 27 ms 604 KB Output is correct
36 Correct 23 ms 856 KB Output is correct
37 Partially correct 44 ms 688 KB Output is partially correct
38 Partially correct 43 ms 928 KB Output is partially correct
39 Correct 25 ms 688 KB Output is correct
40 Correct 24 ms 856 KB Output is correct
41 Correct 26 ms 848 KB Output is correct
42 Correct 30 ms 856 KB Output is correct
43 Correct 7 ms 856 KB Output is correct
44 Correct 26 ms 856 KB Output is correct
45 Correct 21 ms 692 KB Output is correct
46 Correct 13 ms 692 KB Output is correct
47 Correct 12 ms 848 KB Output is correct
48 Correct 17 ms 1112 KB Output is correct