Submission #859000

# Submission time Handle Problem Language Result Execution time Memory
859000 2023-10-09T14:16:14 Z thinknoexit Rarest Insects (IOI22_insects) C++17
0 / 100
1 ms 344 KB
#include <bits/stdc++.h>
#include "insects.h"
using namespace std;
using ll = long long;
bool in[2020];
int min_cardinality(int n) {
    int type = 0;
    for (int i = 0;i < n;i++) {
        move_inside(i);
        if (press_button() == 2) {
            move_outside(i);
        }
        else in[i] = 1, type++;
    }
    for (int i = 0;i < n;i++) if (in[i]) move_outside(i);
    if (type == 1) return n;
    int mxans = n / type;
    for (int i = 2;i <= mxans;i++) {
        int cnt = 0;
        for (int j = 0;j < n;j++) {
            if (in[j]) continue;
            move_inside(j);
            if (press_button() == 2) {
                move_outside(j);
            }
            else in[j] = 1, cnt++;
        }
        if (cnt != type) return i - 1;
    }
    return -1;
    // n , n , n
    /*
        ans <= n / type
        ans <= n - mx
    */

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