Submission #1078185

# Submission time Handle Problem Language Result Execution time Memory
1078185 2024-08-27T13:44:16 Z Muhammad_Aneeq Rarest Insects (IOI22_insects) C++17
0 / 100
47 ms 596 KB
void move_inside(int i);
void move_outside(int i);
int press_button();
#include <iostream>
#include <vector>
#include <map>
#include <set>
#include <bitset>
using namespace std;
int const MAXN=2000;
bitset<MAXN>ind,ni;
int min_cardinality(int N)
{
	int colors=0;
	for (int i=0;i<N;i++)
	{
		move_inside(i);
		ind[i]=1;
		if (press_button()==2)
		{
			move_outside(i);
			ind[i]=0;
		}
		else
			colors++;
	}
	for (int i=0;i<N;i++)
		ni[i]=1-ind[i];
	if (colors==1)
		return N;
	int st=1,en=N/colors+1;
	int cnt=colors;
	while (st+1<en)
	{
		int mid=(st+en)/2;
		for (int i=0;i<N;i++)
		{
			if (cnt==mid*colors)
				break;
			if (ni[i])
			{
				move_inside(i);
				ind[i]=1;
				if (press_button()>mid)
				{
					ind[i]=0;
					move_outside(i);
				}
				else
				{
					cnt++;
					ni[i]=0;
				}
			}
		}
		if (cnt==mid*colors)
			st=mid;
		else
		{
			en=mid;
			for (int i=0;i<N;i++)
			{
				if (ind[i])
				{
					ind[i]=0;
					ni[i]=1;
				}
				else
					ni[i]=0;
			}
			cnt=0;
		}
	}
	return st;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 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 2 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Incorrect 3 ms 344 KB Wrong answer.
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 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 2 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Incorrect 3 ms 344 KB Wrong answer.
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 596 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 1 ms 344 KB Output is correct
7 Correct 9 ms 344 KB Output is correct
8 Correct 6 ms 344 KB Output is correct
9 Correct 26 ms 344 KB Output is correct
10 Partially correct 47 ms 344 KB Output is partially correct
11 Correct 27 ms 344 KB Output is correct
12 Correct 16 ms 344 KB Output is correct
13 Incorrect 30 ms 344 KB Wrong answer.
14 Halted 0 ms 0 KB -