Submission #1135132

#TimeUsernameProblemLanguageResultExecution timeMemory
1135132brianhdzmdoRarest Insects (IOI22_insects)C++20
0 / 100
0 ms408 KiB
#include "insects.h"
#include <bits/stdc++.h>
#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;
    
const int inf = 1e9 + 7;

int min_cardinality(int N)
{

  int ans = 0;

  int minf = 1;

  int maxf = 0;

  int currf = inf;

  std::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;
}

#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...