답안 #1077533

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1077533 2024-08-27T07:54:19 Z Muhammad_Aneeq 드문 곤충 (IOI22_insects) C++17
0 / 100
1 ms 344 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=0,en=N/colors;
	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)
			en=mid;
		else
			st=mid;
	}
	return en;
}

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)
      |       ~~~~~~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Wrong answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 344 KB Wrong answer.
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Incorrect 0 ms 344 KB Wrong answer.
3 Halted 0 ms 0 KB -