Submission #1053698

# Submission time Handle Problem Language Result Execution time Memory
1053698 2024-08-11T15:55:25 Z Ignut Rarest Insects (IOI22_insects) C++17
10 / 100
226 ms 344 KB
/* Ignut
started: 11.08.2024
now: 11.08.2024
████████████████████████████████████████████████████████████████████
████████████████████████████████    ████████████████████████████████
██████████████████████████████        ██████████████████████████████
██████      ██████████████████        ██████████████████      ██████
██████          ██████████████        ██████████████          ██████
██████      ██    ████████████        ████████████    ██      ██████
██████      ████    ██████████        ██████████    ████      ██████
██████      ████      ██████████    ██████████      ████      ██████
██████      ████      ██████████    ██████████    ██████      ██████
██████      ██████    ██████████    ██████████    ██████      ██████
██████      ██████    ████████        ████████    ██████      ██████
██████      ██████      ██████        ██████      ██████      ██████
██████      ████        ████            ████        ████      ██████
██████            ██████████    ████    ██████████            ██████
██████      ██      ██████    ████████    ██████      ██      ██████
██████      ██████            ████████            ██████      ██████
██████                    ██            ██                    ██████
██████████████████████      ████    ████      ██████████████████████
████████████████████████      ██    ██      ████████████████████████
██████████████████████████                ██████████████████████████
██████████████████████████████        ██████████████████████████████
████████████████████████████████████████████████████████████████████
*/

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

void move_inside(int i);
void move_outside(int i);
int press_button();

struct DSU {
    vector<int> p, sz;
    void Init(int n) {
        p.assign(n, 0);
        iota(p.begin(), p.end(), 0);
        sz.assign(n, 1);
    }
    int Get(int v) {
        return p[v] == v ? v : p[v] = Get(p[v]);
    }
    void Unite(int u, int v) {
        u = Get(u), v = Get(v);
        if (u == v) return;
        if (sz[u] > sz[v]) swap(u, v);
        sz[v] += sz[u];
        p[u] = v;
    }
};

int min_cardinality(int N) {
    DSU dsu; dsu.Init(N);
    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) {
                dsu.Unite(i, j);
            }
            move_outside(j);
        }
        move_outside(i);
    }
    int res = N;
    for (int i = 0; i < N; i ++) res = min(res, dsu.sz[dsu.Get(i)]);
    return res;
}
# 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 89 ms 344 KB Output is correct
7 Correct 99 ms 344 KB Output is correct
8 Correct 114 ms 344 KB Output is correct
9 Correct 104 ms 344 KB Output is correct
10 Correct 90 ms 344 KB Output is correct
11 Correct 100 ms 344 KB Output is correct
12 Correct 110 ms 344 KB Output is correct
13 Correct 107 ms 344 KB Output is correct
14 Correct 109 ms 344 KB Output is correct
15 Correct 100 ms 344 KB Output is correct
16 Correct 94 ms 344 KB Output is correct
17 Correct 97 ms 344 KB Output is correct
18 Correct 108 ms 344 KB Output is correct
19 Correct 86 ms 344 KB Output is correct
20 Correct 103 ms 344 KB Output is correct
21 Correct 81 ms 344 KB Output is correct
22 Correct 91 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 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 89 ms 344 KB Output is correct
7 Correct 99 ms 344 KB Output is correct
8 Correct 114 ms 344 KB Output is correct
9 Correct 104 ms 344 KB Output is correct
10 Correct 90 ms 344 KB Output is correct
11 Correct 100 ms 344 KB Output is correct
12 Correct 110 ms 344 KB Output is correct
13 Correct 107 ms 344 KB Output is correct
14 Correct 109 ms 344 KB Output is correct
15 Correct 100 ms 344 KB Output is correct
16 Correct 94 ms 344 KB Output is correct
17 Correct 97 ms 344 KB Output is correct
18 Correct 108 ms 344 KB Output is correct
19 Correct 86 ms 344 KB Output is correct
20 Correct 103 ms 344 KB Output is correct
21 Correct 81 ms 344 KB Output is correct
22 Correct 91 ms 344 KB Output is correct
23 Incorrect 226 ms 344 KB Too many queries.
24 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 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Partially correct 0 ms 344 KB Output is partially correct
6 Partially correct 0 ms 344 KB Output is partially correct
7 Incorrect 201 ms 344 KB Too many queries.
8 Halted 0 ms 0 KB -