답안 #1071702

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1071702 2024-08-23T10:12:39 Z c2zi6 드문 곤충 (IOI22_insects) C++17
10 / 100
269 ms 344 KB
#define _USE_MATH_DEFINES
#include <bits/stdc++.h>
#define ff first
#define ss second
#define pb push_back
#define all(a) (a).begin(), (a).end()
#define replr(i, a, b) for (int i = int(a); i <= int(b); ++i)
#define reprl(i, a, b) for (int i = int(a); i >= int(b); --i)
#define rep(i, n) for (int i = 0; i < int(n); ++i)
#define mkp(a, b) make_pair(a, b)
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> PII;
typedef vector<int> VI;
typedef vector<PII> VPI;
typedef vector<VI> VVI;
typedef vector<VVI> VVVI;
typedef vector<VPI> VVPI;
typedef pair<ll, ll> PLL;
typedef vector<ll> VL;
typedef vector<PLL> VPL;
typedef vector<VL> VVL;
typedef vector<VVL> VVVL;
typedef vector<VPL> VVPL;
template<class T> T setmax(T& a, T b) {if (a < b) return a = b; return a;}
template<class T> T setmin(T& a, T b) {if (a < b) return a; return a = b;}
#include <ext/pb_ds/assoc_container.hpp>
using namespace __gnu_pbds;
template<class T>
using indset = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
#include "insects.h"

int min_cardinality(int n) {
    VI a(n, -1);
    int last = 0;
    replr(i, 0, n-1) if (a[i] == -1) {
        a[i] = last;
        move_inside(i);
        replr(j, i+1, n-1) if (a[j] == -1) {
            move_inside(j);
            if (press_button() == 2) a[j] = a[i];
            move_outside(j);
        }
        move_outside(i);

        last++;
    }
    /*for (int x : a) cout << x << " "; cout << endl;*/
    VI cnt(n);
    for (int x : a) cnt[x]++;
    int ans = 2e9;
    for (int x : cnt) if (x) setmin(ans, x);
    return ans;
}





# 결과 실행 시간 메모리 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 110 ms 344 KB Output is correct
8 Correct 9 ms 344 KB Output is correct
9 Correct 8 ms 344 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 24 ms 344 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 8 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 4 ms 344 KB Output is correct
17 Correct 9 ms 344 KB Output is correct
18 Correct 7 ms 340 KB Output is correct
19 Correct 8 ms 344 KB Output is correct
20 Correct 21 ms 344 KB Output is correct
21 Correct 42 ms 344 KB Output is correct
22 Correct 58 ms 344 KB Output is correct
# 결과 실행 시간 메모리 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 110 ms 344 KB Output is correct
8 Correct 9 ms 344 KB Output is correct
9 Correct 8 ms 344 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 24 ms 344 KB Output is correct
12 Correct 2 ms 344 KB Output is correct
13 Correct 8 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 4 ms 344 KB Output is correct
17 Correct 9 ms 344 KB Output is correct
18 Correct 7 ms 340 KB Output is correct
19 Correct 8 ms 344 KB Output is correct
20 Correct 21 ms 344 KB Output is correct
21 Correct 42 ms 344 KB Output is correct
22 Correct 58 ms 344 KB Output is correct
23 Correct 5 ms 344 KB Output is correct
24 Incorrect 234 ms 344 KB Too many queries.
25 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 ms 344 KB Output is correct
7 Correct 15 ms 344 KB Output is correct
8 Incorrect 269 ms 344 KB Too many queries.
9 Halted 0 ms 0 KB -