# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1135125 | brianhdzmdo | Rarest Insects (IOI22_insects) | C++20 | 0 ms | 0 KiB |
#include "insects.h"
#include <bits/stdc++.h>
#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;
void move_inside(int i)
{
}
void move_outside(int i)
{
}
int press_button();
int min_cardinality(int N)
{
int ans = 0;
int minf = 1;
int maxf = 0;
int currf = LLONG_MAX;
multiset<int> mst;
fr(i, 0, N)
{
move_inside(i);
maxf = press_button();
mst.insert(maxf);
if(currf < maxf)
{
mst.erase(mst.find(currf));
minf = *mst.begin();
}
else if(maxf > minf)
{
mst.erase(mst.find(minf));
minf = *mst.begin();
}
currf = maxf;
}
return minf;
return 0;
}