Submission #1078200

# Submission time Handle Problem Language Result Execution time Memory
1078200 2024-08-27T13:55:55 Z Faisal_Saqib Rarest Insects (IOI22_insects) C++17
0 / 100
64 ms 740 KB
#include <bits/stdc++.h>
using namespace std;
void move_inside(int i);
void move_outside(int i);
int press_button();
int min_cardinality(int n)
{
	set<int> machine,rem;
	int sm=1;
	machine.insert(0);
	move_inside(0);
	for(int i=1;i<n;i++)
	{
		move_inside(i);
		if(press_button()==1)
		{
			sm++;
			machine.insert(i);
		}
		else
		{
			rem.insert(i);
			move_outside(i);
		}
	}
	int sz=sm;
	int s=1;
	int e=(n/sz)+1;
	while(s+1<e)
	{
		int mid=(s+e)/2;
		vector<int> cur;
		for(auto i:rem)
		{
			move_inside(i);
			if(press_button()>mid)
			{
				move_outside(i);
			}
			else
			{
				sm++;
				cur.push_back(i);
				machine.insert(i);
				if(sm==(sz*mid))
					break;
			}
		}
		if(sm==((sz*mid)))
		{
			s=mid;
			//	 We can make values in amachin so keep
			for(auto i:cur)
				rem.erase(i);
		}
		else{
			e=mid;
			rem.clear();
			for(auto i:machine)
			{
				rem.insert(i);
				move_outside(i);
			}
		}
	}
	return s;
}
# Verdict Execution time Memory Grader output
1 Correct 0 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 2 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 3 ms 448 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 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 2 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 3 ms 448 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 1 ms 508 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 23 ms 740 KB Output is correct
8 Correct 14 ms 600 KB Output is correct
9 Correct 20 ms 344 KB Output is correct
10 Partially correct 64 ms 560 KB Output is partially correct
11 Partially correct 40 ms 344 KB Output is partially correct
12 Correct 25 ms 500 KB Output is correct
13 Incorrect 58 ms 600 KB Wrong answer.
14 Halted 0 ms 0 KB -