제출 #630841

#제출 시각아이디문제언어결과실행 시간메모리
630841jwvg0425드문 곤충 (IOI22_insects)C++17
10 / 100
304 ms300 KiB
#include "insects.h"
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <iostream>
#include <string>
#include <bitset>
#include <map>
#include <set>
#include <tuple>
#include <string.h>
#include <math.h>
#include <random>
#include <functional>
#include <assert.h>
#include <math.h>
#define all(x) (x).begin(), (x).end()
#define xx first
#define yy second

using namespace std;

template<typename T, typename Pr = less<T>>
using pq = priority_queue<T, vector<T>, Pr>;
using i64 = long long int;
using ii = pair<int, int>;
using ii64 = pair<i64, i64>;

int min_cardinality(int n)
{
	bool used[2005] = { false, };

	int ans = n;
	for (int i = 0; i < n; i++)
	{
		if (used[i])
			continue;

		used[i] = true;
		vector<int> v = { i, };
		move_inside(i);
		int now = 1;
		for (int j = i + 1; j < n; j++)
		{
			if (used[j])
				continue;

			move_inside(j);
			now++;
			if (press_button() != now)
			{
				move_outside(j);
				now--;
				continue;
			}

			v.push_back(j);
			used[j] = true;
		}

		ans = min(ans, now);

		for (auto& vi : v)
			move_outside(vi);
	}

	return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...