Submission #1074350

#TimeUsernameProblemLanguageResultExecution timeMemory
1074350NicolaikrobRarest Insects (IOI22_insects)C++17
0 / 100
1 ms344 KiB
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
typedef vector<int> vi;

int min_cardinality(int n) {
	vi T(n), C(n, 1);
	for(int i = 0; i < n; i++) T[i] = i;
	for(int i = 0; i < n; i++) {
		if(T[i] != i) continue;
		move_inside(i);
		for(int j = i+1; j < n; j++) {
			move_inside(j);
			int t = press_button();
			if(t == 1) T[j] = T[i], C[i]++, C[j] = n;
			move_outside(j);
		}
		move_outside(i);
	}
	int mn = n;
	for(auto x : C) mn = min(x, mn);
	return mn;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...