답안 #1059492

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1059492 2024-08-15T03:39:16 Z shiomusubi496 드문 곤충 (IOI22_insects) C++17
10 / 100
235 ms 344 KB
#include "insects.h"
#include <bits/stdc++.h>

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define rep2(i, a, b) for (int i = (int)(a); i < (int)(b); ++i)
#define rrep(i, n) for (int i = (int)(n) - 1; i >= 0; --i)
#define rrep2(i, a, b) for (int i = (int)(b) - 1; i >= (int)(a); --i)

#define all(v) begin(v), end(v)
#define rall(v) rbegin(v), rend(v)

using namespace std;

using ll = long long;

template<class T, class U> bool chmin(T& a, const U& b) { return a > b ? a = b, true : false; }
template<class T, class U> bool chmax(T& a, const U& b) { return a < b ? a = b, true : false; }

int min_cardinality(int N) {
    rep (i, N) move_inside(i);
    int x = press_button();
    vector<bool> flag(N, true);
    int cnt = -1;
    int ans = N;
    rrep2 (t, 1, x + 1) {
        int j = -1;
        rep (i, N) {
            if (flag[i]) {
                move_outside(i);
                if (press_button() == t - 1) {
                    j = i;
                    flag[i] = false;
                    break;
                }
            }
        }
        int cnt2 = 1;
        rep (i, j) {
            if (flag[i]) {
                move_inside(i);
                if (press_button() == t) {
                    flag[i] = false;
                    ++cnt2;
                    move_outside(i);
                }
            }
        }
        if (cnt != cnt2) {
            cnt = cnt2;
            ans = t;
        }
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 3 ms 344 KB Output is correct
8 Correct 9 ms 344 KB Output is correct
9 Correct 12 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 61 ms 344 KB Output is correct
12 Correct 4 ms 344 KB Output is correct
13 Correct 4 ms 344 KB Output is correct
14 Correct 10 ms 344 KB Output is correct
15 Correct 10 ms 344 KB Output is correct
16 Correct 10 ms 344 KB Output is correct
17 Correct 4 ms 344 KB Output is correct
18 Correct 9 ms 344 KB Output is correct
19 Correct 6 ms 344 KB Output is correct
20 Correct 9 ms 344 KB Output is correct
21 Correct 5 ms 344 KB Output is correct
22 Correct 5 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 3 ms 344 KB Output is correct
8 Correct 9 ms 344 KB Output is correct
9 Correct 12 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 61 ms 344 KB Output is correct
12 Correct 4 ms 344 KB Output is correct
13 Correct 4 ms 344 KB Output is correct
14 Correct 10 ms 344 KB Output is correct
15 Correct 10 ms 344 KB Output is correct
16 Correct 10 ms 344 KB Output is correct
17 Correct 4 ms 344 KB Output is correct
18 Correct 9 ms 344 KB Output is correct
19 Correct 6 ms 344 KB Output is correct
20 Correct 9 ms 344 KB Output is correct
21 Correct 5 ms 344 KB Output is correct
22 Correct 5 ms 344 KB Output is correct
23 Correct 6 ms 344 KB Output is correct
24 Correct 9 ms 344 KB Output is correct
25 Correct 55 ms 344 KB Output is correct
26 Correct 127 ms 344 KB Output is correct
27 Correct 7 ms 344 KB Output is correct
28 Incorrect 235 ms 344 KB Too many queries.
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 18 ms 344 KB Output is correct
8 Correct 14 ms 344 KB Output is correct
9 Partially correct 145 ms 344 KB Output is partially correct
10 Incorrect 233 ms 344 KB Too many queries.
11 Halted 0 ms 0 KB -