Submission #630958

# Submission time Handle Problem Language Result Execution time Memory
630958 2022-08-17T11:36:43 Z blue Rarest Insects (IOI22_insects) C++17
45.45 / 100
263 ms 524 KB
#include "insects.h"
#include <vector>
#include <iostream>
using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;

const int mx = 2'000;

vi ins(mx, 0);
int ct = 0;

void move_in(int i)
{
	if(ins[i]) 
		return;

	ins[i] = 1;
	move_inside(i);
	ct++;
}

void move_out(int i)
{
	if(!ins[i])
		return;

	ins[i] = 0;
	move_outside(i);
	ct--;
}

int min_cardinality(int N)
{
	int tot = 0;

	vi is_basic(N, 0);

	for(int i = 0; i < N; i++)
	{
		move_inside(i);
		if(press_button() >= 2)
			move_outside(i);
		else
		{
			is_basic[i] = 1;
			tot++;
		}
	}

	// cerr << "tot = " << tot << '\n';


	int uplim = 1;
	for(int e = 11; e >= 0; e--)
	{
		int newlim = uplim + (1<<e);

		for(int i = 0; i < N; i++)
			move_out(i);

		for(int i = 0; i < N; i++)
		{
			move_in(i);
			if(press_button() > newlim)
				move_out(i);
		}

		if(ct == tot * newlim)
			uplim += (1<<e);
	}
	
	return uplim;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 19 ms 208 KB Output is correct
7 Correct 25 ms 208 KB Output is correct
8 Correct 29 ms 208 KB Output is correct
9 Correct 32 ms 208 KB Output is correct
10 Correct 30 ms 208 KB Output is correct
11 Correct 17 ms 208 KB Output is correct
12 Correct 25 ms 208 KB Output is correct
13 Correct 25 ms 208 KB Output is correct
14 Correct 23 ms 208 KB Output is correct
15 Correct 19 ms 208 KB Output is correct
16 Correct 26 ms 208 KB Output is correct
17 Correct 26 ms 208 KB Output is correct
18 Correct 23 ms 208 KB Output is correct
19 Correct 21 ms 208 KB Output is correct
20 Correct 27 ms 208 KB Output is correct
21 Correct 15 ms 208 KB Output is correct
22 Correct 24 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 2 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 19 ms 208 KB Output is correct
7 Correct 25 ms 208 KB Output is correct
8 Correct 29 ms 208 KB Output is correct
9 Correct 32 ms 208 KB Output is correct
10 Correct 30 ms 208 KB Output is correct
11 Correct 17 ms 208 KB Output is correct
12 Correct 25 ms 208 KB Output is correct
13 Correct 25 ms 208 KB Output is correct
14 Correct 23 ms 208 KB Output is correct
15 Correct 19 ms 208 KB Output is correct
16 Correct 26 ms 208 KB Output is correct
17 Correct 26 ms 208 KB Output is correct
18 Correct 23 ms 208 KB Output is correct
19 Correct 21 ms 208 KB Output is correct
20 Correct 27 ms 208 KB Output is correct
21 Correct 15 ms 208 KB Output is correct
22 Correct 24 ms 208 KB Output is correct
23 Correct 104 ms 208 KB Output is correct
24 Correct 118 ms 208 KB Output is correct
25 Correct 79 ms 328 KB Output is correct
26 Correct 121 ms 292 KB Output is correct
27 Correct 55 ms 208 KB Output is correct
28 Correct 108 ms 304 KB Output is correct
29 Correct 113 ms 208 KB Output is correct
30 Correct 84 ms 292 KB Output is correct
31 Correct 104 ms 288 KB Output is correct
32 Correct 126 ms 208 KB Output is correct
33 Correct 95 ms 292 KB Output is correct
34 Correct 115 ms 208 KB Output is correct
35 Correct 90 ms 296 KB Output is correct
36 Correct 99 ms 292 KB Output is correct
37 Correct 127 ms 292 KB Output is correct
38 Correct 70 ms 452 KB Output is correct
39 Correct 112 ms 208 KB Output is correct
40 Correct 99 ms 292 KB Output is correct
41 Correct 120 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Partially correct 1 ms 208 KB Output is partially correct
3 Partially correct 1 ms 208 KB Output is partially correct
4 Partially correct 1 ms 208 KB Output is partially correct
5 Partially correct 1 ms 208 KB Output is partially correct
6 Partially correct 2 ms 208 KB Output is partially correct
7 Partially correct 179 ms 412 KB Output is partially correct
8 Partially correct 203 ms 296 KB Output is partially correct
9 Partially correct 244 ms 304 KB Output is partially correct
10 Partially correct 254 ms 296 KB Output is partially correct
11 Partially correct 225 ms 208 KB Output is partially correct
12 Partially correct 189 ms 296 KB Output is partially correct
13 Partially correct 149 ms 292 KB Output is partially correct
14 Partially correct 238 ms 296 KB Output is partially correct
15 Partially correct 263 ms 416 KB Output is partially correct
16 Partially correct 238 ms 424 KB Output is partially correct
17 Partially correct 225 ms 412 KB Output is partially correct
18 Partially correct 147 ms 300 KB Output is partially correct
19 Partially correct 190 ms 524 KB Output is partially correct
20 Partially correct 199 ms 296 KB Output is partially correct
21 Partially correct 232 ms 404 KB Output is partially correct
22 Partially correct 213 ms 412 KB Output is partially correct
23 Partially correct 222 ms 296 KB Output is partially correct
24 Partially correct 253 ms 296 KB Output is partially correct
25 Partially correct 232 ms 292 KB Output is partially correct
26 Partially correct 200 ms 388 KB Output is partially correct
27 Partially correct 222 ms 316 KB Output is partially correct
28 Partially correct 203 ms 300 KB Output is partially correct
29 Partially correct 152 ms 388 KB Output is partially correct
30 Partially correct 227 ms 296 KB Output is partially correct
31 Partially correct 222 ms 328 KB Output is partially correct
32 Partially correct 199 ms 420 KB Output is partially correct
33 Partially correct 203 ms 356 KB Output is partially correct
34 Partially correct 244 ms 412 KB Output is partially correct
35 Partially correct 196 ms 312 KB Output is partially correct
36 Partially correct 156 ms 336 KB Output is partially correct
37 Partially correct 204 ms 296 KB Output is partially correct
38 Partially correct 206 ms 460 KB Output is partially correct
39 Partially correct 190 ms 412 KB Output is partially correct
40 Partially correct 245 ms 296 KB Output is partially correct
41 Partially correct 188 ms 292 KB Output is partially correct
42 Partially correct 245 ms 292 KB Output is partially correct
43 Partially correct 55 ms 208 KB Output is partially correct
44 Partially correct 185 ms 296 KB Output is partially correct
45 Partially correct 230 ms 448 KB Output is partially correct
46 Partially correct 224 ms 304 KB Output is partially correct
47 Partially correct 126 ms 400 KB Output is partially correct
48 Partially correct 243 ms 420 KB Output is partially correct