Submission #627402

# Submission time Handle Problem Language Result Execution time Memory
627402 2022-08-12T14:31:24 Z sofapuden Rarest Insects (IOI22_insects) C++17
0 / 100
73 ms 328 KB
#include "insects.h"
#include<bits/stdc++.h>

using namespace std;

int min_cardinality(int n) {
	int am = 1;
	move_inside(0);
	vector<int> st(n,0);
	st[0] = 1;
	int sz = 1;
	for(int i = 1; i < n; ++i){
		move_inside(i);
		if(press_button() != 1)move_outside(i);
		else am++, st[i] = 1, sz++;
	}
	int l = 2, r = n/am, cur = 1;
	while(l <= r){
		int m = (l+r)>>1;
		vector<int> rem;
		for(int i = 0; i < n; ++i){
			if(st[i])continue;
			sz++;
			move_inside(i);
			if(press_button() > m){
				rem.push_back(i);
				sz--;
				move_outside(i);
			}
		}
		if(sz == am*m){
			for(int i = 0; i < n; ++i)st[i] = 1;
			for(auto x : rem)st[x] = 0;
			cur = m;
			l = m + 1;
		}
		else{
			r = m - 1;
			for(auto x : rem)st[x] = 1;
			for(int i = 0; i < n; ++i){
				if(!st[i])move_outside(i);
			}
		}
	}
	return cur;
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 0 ms 208 KB Output is correct
6 Correct 5 ms 208 KB Output is correct
7 Correct 4 ms 208 KB Output is correct
8 Correct 6 ms 208 KB Output is correct
9 Incorrect 4 ms 208 KB Wrong answer.
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 0 ms 208 KB Output is correct
6 Correct 5 ms 208 KB Output is correct
7 Correct 4 ms 208 KB Output is correct
8 Correct 6 ms 208 KB Output is correct
9 Incorrect 4 ms 208 KB Wrong answer.
10 Halted 0 ms 0 KB -
# 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 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 1 ms 208 KB Output is correct
7 Correct 63 ms 288 KB Output is correct
8 Correct 23 ms 208 KB Output is correct
9 Correct 73 ms 284 KB Output is correct
10 Correct 25 ms 208 KB Output is correct
11 Correct 60 ms 304 KB Output is correct
12 Correct 38 ms 292 KB Output is correct
13 Incorrect 46 ms 328 KB Wrong answer.
14 Halted 0 ms 0 KB -