답안 #1084406

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1084406 2024-09-06T08:15:22 Z SamueleVid 드문 곤충 (IOI22_insects) C++17
10 / 100
250 ms 448 KB
#include <bits/stdc++.h>
using namespace std;

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

int min_cardinality(int N) {
    
    vector<int> type(N, -1);
    for (int i = 0; i < N; i ++) {
        if (type[i] != -1) continue;
        type[i] = i;
        stack<int> dentro;
        dentro.push(i);
        move_inside(i);
        for (int j = i + 1; j < N; j ++) {
            dentro.push(j);
            move_inside(j);
            if (press_button() < dentro.size()) {
                move_outside(j);
                dentro.pop();
            }
            else {
                type[j] = i;
            }
        }
        while (!dentro.empty()) {
            move_outside(dentro.top()); dentro.pop();
        }

    }

    // cout << "types : " << '\n';
    // for (auto x : type) cout << x << " ";
    // cout << '\n';

    map<int, int> numero_types;
    for (auto x : type) numero_types[x] ++;
    int minore = 1e9;
    for (auto [_, x] : numero_types) minore = min(minore, x);

    return minore;
}

Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:20:32: warning: comparison of integer expressions of different signedness: 'int' and 'std::stack<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |             if (press_button() < dentro.size()) {
      |                 ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 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 2 ms 344 KB Output is correct
7 Correct 111 ms 412 KB Output is correct
8 Correct 14 ms 408 KB Output is correct
9 Correct 17 ms 412 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 65 ms 412 KB Output is correct
12 Correct 5 ms 344 KB Output is correct
13 Correct 13 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 8 ms 344 KB Output is correct
16 Correct 14 ms 344 KB Output is correct
17 Correct 13 ms 344 KB Output is correct
18 Correct 13 ms 412 KB Output is correct
19 Correct 16 ms 408 KB Output is correct
20 Correct 32 ms 416 KB Output is correct
21 Correct 61 ms 412 KB Output is correct
22 Correct 86 ms 412 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 2 ms 344 KB Output is correct
7 Correct 111 ms 412 KB Output is correct
8 Correct 14 ms 408 KB Output is correct
9 Correct 17 ms 412 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 65 ms 412 KB Output is correct
12 Correct 5 ms 344 KB Output is correct
13 Correct 13 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 8 ms 344 KB Output is correct
16 Correct 14 ms 344 KB Output is correct
17 Correct 13 ms 344 KB Output is correct
18 Correct 13 ms 412 KB Output is correct
19 Correct 16 ms 408 KB Output is correct
20 Correct 32 ms 416 KB Output is correct
21 Correct 61 ms 412 KB Output is correct
22 Correct 86 ms 412 KB Output is correct
23 Correct 7 ms 344 KB Output is correct
24 Incorrect 250 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 1 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 12 ms 448 KB Output is correct
8 Incorrect 212 ms 344 KB Too many queries.
9 Halted 0 ms 0 KB -