#include "insects.h"
#include <iostream>
#include <vector>
#include <set>
#define all(a) (a).begin(), (a).end()
#define allr(a) (a).rbegin(), (a).rend()
#define ll long long
#define lli long long int
#define fr(i, a, b) for (ll i = a; i < b; i++)
#define fr1(i, a, b) for (ll i = a - 1; i >= b; i--)
#define fi first
#define se second
#define mp(j, k) make_pair(j, k)
#define pb(x) push_back(x)
#define pbp(x, y) push_back({x, y})
#define in(x) insert(x)
#define vec vector<ll>
#define vecb vector<bool>
#define vecp vector<pair<ll, ll>>
#define vecv vector<vector<ll>>
#define yes cout << "YES\n";
#define no cout << "NO\n";
#define ac 1e-7
#define fauto(a) \
for (auto i : a) \
cout << i << " ";
#define fautop(a) \
for (auto i : a) \
cout << i.fi << " " << i.se << endl;
using namespace std;
const int inf = -1e9 + 7;
int min_cardinality(int N)
{
int n = N;
int maxf = 0;
fr(i, 0, n) move_inside(i);
maxf = press_button();
int freq = 0;
int siz = n;
int ans = inf;
vecb vb(n, false);
fr(i, 0, siz)
{
fr(j, 0, n)
{
if(vb[i]) continue;
move_outside(j);
freq = press_button();
if(freq <= maxf)
{
vb[j] = true;
siz--;
}
else
move_inside(j);
}
maxf = press_button();
ans = min(ans, maxf);
}
return ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |