Submission #1211964

#TimeUsernameProblemLanguageResultExecution timeMemory
1211964serkanrashidRarest Insects (IOI22_insects)C++20
0 / 100
0 ms412 KiB
#include "insects.h"
#include <bits/stdc++.h>
#define endl "\n"

using namespace std;

const int MAXN = 2048;
int n;
int used[MAXN];

int min_cardinality(int N)
{
    n = N;

    int ans = 1e9;


    vector<pair<int,int> >p;

    for(int i = 0; i < n; i++)
    {
        move_inside(i);
        bool f = false;
        for(int j = 0; j < p.size(); j++)
        {
            pair<int,int>nb = p[j];
            move_inside(nb.second);
            int pb = press_button();
            move_outside(nb.second);

            if(pb == 1)
            {
                nb.first++;
                p[j] = nb;
                f = true;
            }
            if(f) break;
        }
        if(!f) p.push_back({1,i});
        move_outside(i);

        sort(p.begin(),p.end());
        if(p.size() > 6) p.pop_back();
    }
    return p[0].first;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...