Submission #630951

# Submission time Handle Problem Language Result Execution time Memory
630951 2022-08-17T11:32:00 Z blue Catfish Farm (IOI22_fish) C++17
Compilation error
0 ms 0 KB
#include "insects.h"
#include <vector>
#include <iostream>
using namespace std;

using vi = vector<int>;
using vvi = vector<vi>;

const int mx = 2'000;

vi ins(mx, 0);
int ct = 0;

void move_in(int i)
{
	if(ins[i]) 
		return;

	ins[i] = 1;
	move_inside(i);
	ct++;
}

void move_out(int i)
{
	if(!ins[i])
		return;

	ins[i] = 0;
	move_outside(i);
	ct--;
}

int min_cardinality(int N)
{
	int tot = 0;

	vi is_basic(N, 0);

	for(int i = 0; i < N; i++)
	{
		move_inside(i);
		if(press_button() >= 2)
			move_outside(i);
		else
		{
			is_basic[i] = 1;
			tot++;
		}
	}

	// cerr << "tot = " << tot << '\n';


	int lo = 1, hi = N/tot;
	while(lo != hi)
	{
		int mid = (lo + hi)/2 + 1;

		// cerr << lo << ' ' << hi << " : " << mid << '\n';

		for(int i = 0; i < N; i++)
			move_out(i);

		for(int i = 0; i < N; i++)
		{
			move_in(i);
			if(press_button() > mid)
				move_out(i);
		}

		if(ct == tot * mid)
			lo = mid;
		else
			hi = mid - 1;
	}

	return lo;
}

Compilation message

fish.cpp:1:10: fatal error: insects.h: No such file or directory
    1 | #include "insects.h"
      |          ^~~~~~~~~~~
compilation terminated.