Submission #1051178

# Submission time Handle Problem Language Result Execution time Memory
1051178 2024-08-09T22:23:11 Z Trent Rarest Insects (IOI22_insects) C++17
25 / 100
202 ms 596 KB
#include "insects.h"
#include "bits/stdc++.h"
using namespace std;
#define forR(i, x) for(int i = 0; i < (x); ++i)
#define REP(i, a, b) for(int i = (a); i < (b); ++i)
#define all(x) x.begin(), x.end()
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ll> vll;
typedef vector<bool> vb;

int INF = 1e7;
int min_cardinality(int N) {
  vvi dst;
  set<int> vals;
  forR(i, N) vals.insert(i);
  while(dst.size() <= 1 || dst[dst.size() - 1].size() == dst[dst.size() - 2].size()) {
    dst.emplace_back();
    for(int i : vals) {
      move_inside(i);
      if(press_button() == dst.size()) {
        dst.back().push_back(i);
      } else {
        move_outside(i);
      }
    }
    for(int i : dst.back()) vals.erase(vals.find(i));
    if(dst.size() == 1 && dst.back().size() <= 32) {
      for(int i : dst.back()) move_outside(i);
      int mVal = INF;
      for(int i : dst.back()) {
        move_inside(i);
        int tot = 0;
        for(int j : vals) {
          move_inside(j);
          if(press_button() == 2) ++tot;
          move_outside(j);
        }
        mVal = min(mVal, tot + 1);
        move_outside(i);
      }
      return mVal;
    }
  }
  // for(vi& i : dst) {
  //   for(int j : i) cerr << j << ' ';
  //   cerr << '\n';
  // }
  return dst.size() - 1;
}

Compilation message

insects.cpp: In function 'int min_cardinality(int)':
insects.cpp:22:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::vector<int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |       if(press_button() == dst.size()) {
      |          ~~~~~~~~~~~~~~~^~~~~~~~~~~~~
# Verdict Execution time Memory 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 408 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 10 ms 420 KB Output is correct
9 Correct 10 ms 344 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 6 ms 344 KB Output is correct
13 Correct 13 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 9 ms 344 KB Output is correct
16 Correct 6 ms 344 KB Output is correct
17 Correct 8 ms 344 KB Output is correct
18 Correct 9 ms 344 KB Output is correct
19 Correct 13 ms 344 KB Output is correct
20 Correct 2 ms 344 KB Output is correct
21 Correct 1 ms 444 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory 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 408 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 10 ms 420 KB Output is correct
9 Correct 10 ms 344 KB Output is correct
10 Correct 2 ms 344 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 6 ms 344 KB Output is correct
13 Correct 13 ms 344 KB Output is correct
14 Correct 3 ms 344 KB Output is correct
15 Correct 9 ms 344 KB Output is correct
16 Correct 6 ms 344 KB Output is correct
17 Correct 8 ms 344 KB Output is correct
18 Correct 9 ms 344 KB Output is correct
19 Correct 13 ms 344 KB Output is correct
20 Correct 2 ms 344 KB Output is correct
21 Correct 1 ms 444 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 9 ms 344 KB Output is correct
24 Correct 5 ms 344 KB Output is correct
25 Correct 158 ms 344 KB Output is correct
26 Correct 164 ms 344 KB Output is correct
27 Correct 17 ms 344 KB Output is correct
28 Correct 6 ms 344 KB Output is correct
29 Correct 18 ms 344 KB Output is correct
30 Correct 131 ms 344 KB Output is correct
31 Correct 25 ms 596 KB Output is correct
32 Correct 34 ms 344 KB Output is correct
33 Correct 51 ms 344 KB Output is correct
34 Correct 49 ms 344 KB Output is correct
35 Correct 78 ms 344 KB Output is correct
36 Correct 109 ms 344 KB Output is correct
37 Correct 33 ms 340 KB Output is correct
38 Correct 9 ms 344 KB Output is correct
39 Correct 6 ms 344 KB Output is correct
40 Correct 6 ms 344 KB Output is correct
41 Correct 8 ms 344 KB Output is correct
# Verdict Execution time Memory 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 14 ms 344 KB Output is correct
8 Correct 10 ms 344 KB Output is correct
9 Incorrect 202 ms 516 KB Too many queries.
10 Halted 0 ms 0 KB -