Submission #1027540

# Submission time Handle Problem Language Result Execution time Memory
1027540 2024-07-19T07:24:44 Z PatrikPrit Rarest Insects (IOI22_insects) C++17
10 / 100
278 ms 436 KB
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;

#define all(x) (x).begin(), (x).end()

typedef long long ll;

int min_cardinality(int N) {
    vector<int> group(N);
    iota(all(group),0);

    for (int a=0;a<N;a++){
        if (group[a]==a){
            move_inside(a);
            for (int b=a+1;b<N;b++){
                if (group[b]==b){
                    move_inside(b);
                    int card = press_button();
                    if (card==2){
                        group[b]=group[a];
                    }
                    move_outside(b);
                }

            }
            move_outside(a);
        }
    }

    vector<int> group_f(N,0);
    for (int e:group){
        group_f[e]++;
    }
    int ans=N;
    for (int f:group_f){
        if (f>0){
            ans=min(ans,f);
        }
    }

    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 1 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 Correct 1 ms 344 KB Output is correct
7 Correct 118 ms 344 KB Output is correct
8 Correct 8 ms 344 KB Output is correct
9 Correct 13 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 32 ms 344 KB Output is correct
12 Correct 3 ms 344 KB Output is correct
13 Correct 7 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 4 ms 344 KB Output is correct
16 Correct 6 ms 344 KB Output is correct
17 Correct 8 ms 344 KB Output is correct
18 Correct 13 ms 344 KB Output is correct
19 Correct 5 ms 344 KB Output is correct
20 Correct 30 ms 344 KB Output is correct
21 Correct 35 ms 344 KB Output is correct
22 Correct 70 ms 344 KB Output is correct
# 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 1 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 Correct 1 ms 344 KB Output is correct
7 Correct 118 ms 344 KB Output is correct
8 Correct 8 ms 344 KB Output is correct
9 Correct 13 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 32 ms 344 KB Output is correct
12 Correct 3 ms 344 KB Output is correct
13 Correct 7 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 4 ms 344 KB Output is correct
16 Correct 6 ms 344 KB Output is correct
17 Correct 8 ms 344 KB Output is correct
18 Correct 13 ms 344 KB Output is correct
19 Correct 5 ms 344 KB Output is correct
20 Correct 30 ms 344 KB Output is correct
21 Correct 35 ms 344 KB Output is correct
22 Correct 70 ms 344 KB Output is correct
23 Correct 4 ms 436 KB Output is correct
24 Incorrect 278 ms 344 KB Too many queries.
25 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 Correct 1 ms 344 KB Output is correct
7 Correct 12 ms 416 KB Output is correct
8 Incorrect 268 ms 344 KB Too many queries.
9 Halted 0 ms 0 KB -