# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1005489 | khanhtb | Rarest Insects (IOI22_insects) | C++17 | 235 ms | 344 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
#include "insects.h"
#define ll int
#define ull unsigned long long
#define ld double
#define pb push_back
#define pf push_front
#define vi vector<ll>
#define vii vector<vi>
#define pll pair<ll,ll>
#define vpll vector<pll>
#define all(a) a.begin(), a.end()
#define fi first
#define se second
using namespace std;
const ll mod = 1e9+7;
const ll inf = 1e18;
const ll base = 31;
const ll blocksz = 320;
const ll N = 1e5+8;
int col[N];
int c[N];
int min_cardinality(int n){
int now_col = 1;
for(int i = 0; i < n; i++){
if(!col[i]){
vi clear_col;
clear_col.pb(i);
move_inside(i), col[i] = now_col;
int cnt = 1;
for(int j = i+1; j < n; j++){
if(!col[j]){
move_inside(j);
int rep = press_button();
if(rep > cnt) col[j] = now_col, cnt++, clear_col.pb(j);
else move_outside(j);
}
}
for(int x:clear_col) move_outside(x);
now_col++;
}
}
for(int i = 0; i < n; i++) c[col[i]]++;
int ans = N;
for(int i = 0; i < n; i++){
if(c[col[i]] > 0) ans = min(ans,c[col[i]]);
}
return ans;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |