Submission #1000044

# Submission time Handle Problem Language Result Execution time Memory
1000044 2024-06-16T13:58:12 Z kunzaZa183 Rarest Insects (IOI22_insects) C++17
10 / 100
289 ms 428 KB
#include "insects.h"

#include <bits/stdc++.h>
using namespace std;

int min_cardinality(int N) {
  vector<int> cur;
  vector<int> each(N);
  int ct = 0;
  for (int i = 0; i < N; i++) {
    cur.push_back(i);
    move_inside(i);
    int res = press_button();
    if (res == 1)
      each[i] = ct++;
    else {
      int sth;
      for (auto a : cur) {
        move_outside(a);
        res = press_button();
        if (res == 1) {
          sth = a;
          each[i] = each[a];
          break;
        }
        move_inside(a);
      }
      cur.erase(find(cur.begin(), cur.end(), sth));
    }
  }
  map<int, int> mii;
  for (auto a : each) mii[a]++;
  vector<pair<int, int>> vpii;
  for (auto [a, b] : mii) vpii.emplace_back(b, a);
  sort(vpii.begin(), vpii.end());
  // for (auto a : vpii) cout << a.first << ' ' << a.second << "\n";
  // for (auto a : each) cout << a << ' ';
  // cout << "\n";
  return vpii.front().first;
}
# 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 2 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 7 ms 344 KB Output is correct
9 Correct 9 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 20 ms 412 KB Output is correct
12 Correct 4 ms 344 KB Output is correct
13 Correct 6 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 4 ms 344 KB Output is correct
16 Correct 7 ms 344 KB Output is correct
17 Correct 6 ms 344 KB Output is correct
18 Correct 7 ms 344 KB Output is correct
19 Correct 7 ms 344 KB Output is correct
20 Correct 22 ms 428 KB Output is correct
21 Correct 18 ms 412 KB Output is correct
22 Correct 20 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 2 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 7 ms 344 KB Output is correct
9 Correct 9 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 20 ms 412 KB Output is correct
12 Correct 4 ms 344 KB Output is correct
13 Correct 6 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 4 ms 344 KB Output is correct
16 Correct 7 ms 344 KB Output is correct
17 Correct 6 ms 344 KB Output is correct
18 Correct 7 ms 344 KB Output is correct
19 Correct 7 ms 344 KB Output is correct
20 Correct 22 ms 428 KB Output is correct
21 Correct 18 ms 412 KB Output is correct
22 Correct 20 ms 344 KB Output is correct
23 Correct 11 ms 344 KB Output is correct
24 Correct 5 ms 344 KB Output is correct
25 Correct 81 ms 412 KB Output is correct
26 Correct 89 ms 416 KB Output is correct
27 Correct 12 ms 344 KB Output is correct
28 Incorrect 261 ms 412 KB Too many queries.
29 Halted 0 ms 0 KB -
# 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 0 ms 344 KB Output is correct
7 Correct 21 ms 344 KB Output is correct
8 Correct 13 ms 344 KB Output is correct
9 Incorrect 289 ms 344 KB Too many queries.
10 Halted 0 ms 0 KB -