제출 #703563

#제출 시각아이디문제언어결과실행 시간메모리
703563t6twotwo드문 곤충 (IOI22_insects)C++17
10 / 100
349 ms248 KiB
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int min_cardinality(int n) {
    vector<int> p(n);
    iota(p.begin(), p.end(), 0);
    for (int i = 0; i < n; i++) {
        move_inside(i);
        for (int j = i + 1; j < n; j++) {
            move_inside(j);
            if (press_button() == 2) {
                p[j] = p[i];
            }
            move_outside(j);
        }
        move_outside(i);
    }
    vector<int> cnt(n);
    for (int i = 0; i < n; i++) {
        cnt[p[i]]++;
    }
    int ans = n;
    for (int i = 0; i < n; i++) {
        if (cnt[i] > 0) {
            ans = min(ans, cnt[i]);
        }
    }
    return ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...