제출 #725612

#제출 시각아이디문제언어결과실행 시간메모리
725612aykhn드문 곤충 (IOI22_insects)C++17
0 / 100
1 ms208 KiB
#include <bits/stdc++.h>
#include "insects.h"

using namespace std;

typedef long long ll;

#define OPT ios_base::sync_with_stdio(0); \
            cin.tie(0); \
            cout.tie(0)
#define pii pair<int,int>
#define pll pair<ll,ll>
#define all(v) v.begin(), v.end()
#define mpr make_pair
#define pb push_back
#define ts to_string
#define fi first
#define se second
#define inf 0x3F3F3F3F
#define infll 0x3F3F3F3F3F3F3F3FLL
#define bpc __builtin_popcount
#define print(v) for(int i = 0; i < v.size(); i++) cout << v[i] << " "; cout<<endl;

int min_cardinality(int n)
{
    int sz = 0;
    vector<bool> used(n, 0);

    for (int i = 0; i < n; i++)
    {
        if (used[i]) continue;

        move_inside(i);
        int x = press_button();
        if (x > 1) move_outside(i);
        else
        {
            sz++;
            used[i] = 1;
        }
    }
    int counter = 2;
    int rn = sz;
    while (1)
    {
        for (int i = 0; i < n; i++)
        {
            if (used[i]) continue;
            move_inside(i);
            int x = press_button();
            if (x > counter) move_outside(i);
            else
            {
                rn++;
                used[i] = 1;
            }
        }

        if (rn < counter * sz)
        {
            return counter;
        }

        counter++;
    }
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...