Submission #1077550

# Submission time Handle Problem Language Result Execution time Memory
1077550 2024-08-27T07:58:51 Z Muhammad_Aneeq Rarest Insects (IOI22_insects) C++17
0 / 100
167 ms 684 KB
void move_inside(int i);
void move_outside(int i);
int press_button();
#include <iostream>
#include <vector>
using namespace std;
int min_cardinality(int N)
{
	int colors=0;
	vector<int>ind;
	for (int i=0;i<N;i++)
	{
		move_inside(i);
		if (press_button()==2)
			move_outside(i);
		else
		{
			colors++;
			ind.push_back(i);
		}
	}
	for (auto i:ind)
		move_outside(i);
	int st=1,en=N/colors+1;
	while (st+1<en)
	{
		int mid=(st+en)/2;
		ind={};
		for (int i=0;i<N;i++)
		{
			move_inside(i);
			if (press_button()>mid)
				move_outside(i);
			else
				ind.push_back(i);
		}
		if (ind.size()==mid*colors)
			st=mid;
		else
			en=mid;
	}
	return st;
}

Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:37:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   37 |   if (ind.size()==mid*colors)
      |       ~~~~~~~~~~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 11 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 344 KB Output is correct
9 Incorrect 4 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 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 11 ms 344 KB Output is correct
7 Correct 2 ms 600 KB Output is correct
8 Correct 5 ms 344 KB Output is correct
9 Incorrect 4 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 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 1 ms 344 KB Output is correct
6 Partially correct 0 ms 344 KB Output is partially correct
7 Partially correct 167 ms 436 KB Output is partially correct
8 Correct 8 ms 592 KB Output is correct
9 Partially correct 76 ms 344 KB Output is partially correct
10 Partially correct 83 ms 588 KB Output is partially correct
11 Partially correct 134 ms 344 KB Output is partially correct
12 Correct 32 ms 600 KB Output is correct
13 Partially correct 108 ms 344 KB Output is partially correct
14 Partially correct 68 ms 344 KB Output is partially correct
15 Incorrect 104 ms 684 KB Wrong answer.
16 Halted 0 ms 0 KB -