Submission #971008

# Submission time Handle Problem Language Result Execution time Memory
971008 2024-04-27T19:37:54 Z ALeonidou Rarest Insects (IOI22_insects) C++17
0 / 100
1 ms 344 KB
#include "insects.h"

#include <variant>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

#define ll int
#define F first
#define S second
#define pb push_back
#define sz(x) (ll)x.size()
#define endl "\n"

typedef vector <ll> vi;
typedef pair <ll, ll> ii;
typedef vector <ii> vii;
    
#define dbg(x) cout<<#x<<": "<<x<<endl;
#define dbg2(x,y) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<endl;
#define dbg3(x,y,z) cout<<#x<<": "<<x<<" "<<#y<<": "<<y<<" "<<#z<<": "<<z<<endl;
    
void printVct(vi &v){
    for (ll i =0; i<sz(v); i++){
            cout<<v[i]<<" ";
    }
    cout<<endl;
}


int min_cardinality(int N){
    ll n = N;
    vi v(n);
    for (ll i =0; i<n; i++){
        v[i] = i;
    }
    for (ll i =0; i<n; i++){
        move_inside(i);
        for (ll j =i+1; j<n; j++){
            move_inside(j);
            ll x = press_button();
            if (x == 2){
                v[j] = v[i];
            }
            move_outside(j);
        }
        move_outside(i);
    }

    // printVct(v);

    sort(v.begin(), v.end());

    ll cur = 1, ans = n;
    for (ll i =0; i<n; i++){
        if (v[i] != v[i-1]){
            ans = min(ans, cur);
            cur = 0;
        }
        cur++;
    }
    ans = min(ans, cur);

    return ans;
}


/*

6
5 8 9 5 9 9


*/












# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB Wrong answer.
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Incorrect 0 ms 344 KB Wrong answer.
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Incorrect 0 ms 344 KB Wrong answer.
5 Halted 0 ms 0 KB -