제출 #1339293

#제출 시각아이디문제언어결과실행 시간메모리
1339293limitsRarest Insects (IOI22_insects)C++20
10 / 100
52 ms428 KiB
#pragma GCC optimize("Ofast")
#pragma GCC optimize("O3,unroll-loops")

#include <bits/stdc++.h>

using namespace std;

#define f0r(i, n) for (auto i = 0; i < (n); ++i)
#define fnr(i, n, k) for (auto i = (n); i < (k); ++i)
#define all(v) (v).begin(), (v).end()
#define pb push_back
#define F first
#define S second
#define ctn(x) cout << x << '\n'
#define forl(a, l) for (auto a : l)
#define ctl(l) for (auto &a : (l)) cout << a << ' '; cout << endl;
#define lb(v, x) (lower_bound(all(v), x) - begin(v))
#define ub(v, x) (upper_bound(all(v), x) - begin(v))
#define pq priority_queue

template <class T>
using V = vector<T>;
using ll = long long;
using vi = V<int>;
using vl = V<ll>;
using pi = pair<int, int>;
using ti = tuple<int, int, int>;
using Adj = V<vi>;
using vvi = V<vi>;

#include "insects.h"

int min_cardinality(int N) {
	V<vi> comps;
	f0r(i, N) {
		move_inside(i);
		bool fnd = 0;
		forl(&v, comps) {
			forl(x, v) move_inside(x);
			if (press_button() > (int)v.size()) {
				v.pb(i);
				fnd = 1;
				forl(x, v) move_outside(x);
				break;
			}
			forl(x, v) move_outside(x);
		}
		if (!fnd) comps.pb({i});
		move_outside(i);
	}
	int mn = 1e9;
	forl(&v, comps) mn = min(mn, (int)v.size());
	return mn;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...