Submission #1069339

# Submission time Handle Problem Language Result Execution time Memory
1069339 2024-08-21T19:45:42 Z mariaclara Rarest Insects (IOI22_insects) C++17
0 / 100
1 ms 344 KB
#include "insects.h"
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define mk make_pair
#define pb push_back
#define fr first
#define sc second

int min_cardinality(int N) {
    srand(5465310);

    vector<int> ord(N), vis(N);
    for(int i = 0; i < N; i++) ord[i] = i;

    random_shuffle(all(ord));

    int ans = N;

    for(int i = 0; i < N; i++) {
        if(vis[ord[i]]) continue;
        move_inside(ord[i]);
        int at = 1;

        for(int j = i+1; j < N; j++) {
            if(vis[j]) continue;

            move_inside(ord[j]);
            if(press_button() == 2) at++, vis[j] = 1;
            move_outside(ord[j]);
        }

        move_outside(ord[i]);
        ans = min(ans, at);
        if(ans == 1) break;
    }

    return ans;
}
# 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 1 ms 344 KB Wrong answer.
5 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 1 ms 344 KB Wrong answer.
5 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 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Incorrect 0 ms 344 KB Wrong answer.
7 Halted 0 ms 0 KB -