Submission #1078258

# Submission time Handle Problem Language Result Execution time Memory
1078258 2024-08-27T14:36:25 Z allin27x Rarest Insects (IOI22_insects) C++17
0 / 100
228 ms 696 KB
#include <bits/stdc++.h>
#include "insects.h"
using namespace std;
#define int long long

//void move_inside(int)
//void move_outside(int)
// int press_button()

signed min_cardinality(signed N){
    std::random_device rd;
    std::mt19937 g(rd());
    vector<int> bad(N,0);
    vector<int> prm(N); iota(prm.begin(), prm.end(), 0);
    for (int i=0; i<9; i++) {
        shuffle(prm.begin(), prm.end(), g);
        int last = 0;
        for (int i=0; i<N; i++) {
            move_inside(prm[i]);
            int r = press_button();
            if (r != last) bad[prm[i]] ++;
            last = r;
        }
        shuffle(prm.begin(), prm.end(), g);
        for (int i=0; i<N; i++) {
            move_outside(prm[i]);
            int r = press_button();
            if (r != last) bad[prm[i]] ++;
            last = r;
        }
    }
    for (int i=0; i<N; i++) move_inside(i);
    vector<pair<int,int>> w;
    for (int i=0; i<N; i++) w.push_back({bad[i],i});
    sort(w.begin(), w.end());
    int r = press_button();
    while (r != w.size()) {
        for (int i=0; i<r; i++) {
            move_outside(w.back().second); w.pop_back();
        }
        r = press_button();
    }
    return r;
}

Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:37:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |     while (r != w.size()) {
      |            ~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 18 ms 440 KB Output is correct
7 Correct 14 ms 344 KB Output is correct
8 Incorrect 17 ms 440 KB Wrong answer.
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 18 ms 440 KB Output is correct
7 Correct 14 ms 344 KB Output is correct
8 Incorrect 17 ms 440 KB Wrong answer.
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Partially correct 0 ms 344 KB Output is partially correct
3 Partially correct 1 ms 344 KB Output is partially correct
4 Partially correct 1 ms 344 KB Output is partially correct
5 Partially correct 1 ms 344 KB Output is partially correct
6 Partially correct 1 ms 344 KB Output is partially correct
7 Partially correct 228 ms 448 KB Output is partially correct
8 Partially correct 209 ms 696 KB Output is partially correct
9 Incorrect 210 ms 452 KB Wrong answer.
10 Halted 0 ms 0 KB -