Submission #627226

# Submission time Handle Problem Language Result Execution time Memory
627226 2022-08-12T11:36:41 Z model_code Rarest Insects (IOI22_insects) C++17
25 / 100
247 ms 396 KB
// correct/solution-binser-2nlogn.cpp
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;

int min_cardinality(int N) {
  int ans = N;
  int L = 1, R = N - 1;
  while (L <= R) {
    int mid = (L + R)/2;
    vector <int> in, out, rest;
    
    for (int i = 0; i < N; i++) {
      move_inside(i);
      if (press_button() > mid) {
        move_outside(i);
        out.push_back(i);
      }
      else {
        in.push_back(i);
      }
    }
    
    for (int x : in) {
      move_outside(x);
    }
    
    for (int x : out) {
      move_inside(x);
      if (press_button() == 2) {
        move_outside(x);
      }
      else {
        rest.push_back(x);
      }
    }
    
    bool full = true;
    for (int x : in) {
      move_inside(x);
      if (press_button() == 1) {
        move_outside(x);
        full = false;
        break;
      }
      move_outside(x);
    }
    
    for (int x : rest) {
      move_outside(x);
    }
    
    if (full) {
      L = mid + 1;
    }
    else {
      R = mid - 1;
      ans = mid;
    }
  }
  
  return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 33 ms 208 KB Output is correct
7 Correct 10 ms 208 KB Output is correct
8 Correct 17 ms 208 KB Output is correct
9 Correct 15 ms 208 KB Output is correct
10 Correct 23 ms 300 KB Output is correct
11 Correct 15 ms 208 KB Output is correct
12 Correct 27 ms 208 KB Output is correct
13 Correct 20 ms 208 KB Output is correct
14 Correct 18 ms 208 KB Output is correct
15 Correct 26 ms 208 KB Output is correct
16 Correct 18 ms 208 KB Output is correct
17 Correct 19 ms 208 KB Output is correct
18 Correct 17 ms 208 KB Output is correct
19 Correct 16 ms 208 KB Output is correct
20 Correct 15 ms 208 KB Output is correct
21 Correct 13 ms 300 KB Output is correct
22 Correct 11 ms 208 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 208 KB Output is correct
2 Correct 0 ms 208 KB Output is correct
3 Correct 0 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 33 ms 208 KB Output is correct
7 Correct 10 ms 208 KB Output is correct
8 Correct 17 ms 208 KB Output is correct
9 Correct 15 ms 208 KB Output is correct
10 Correct 23 ms 300 KB Output is correct
11 Correct 15 ms 208 KB Output is correct
12 Correct 27 ms 208 KB Output is correct
13 Correct 20 ms 208 KB Output is correct
14 Correct 18 ms 208 KB Output is correct
15 Correct 26 ms 208 KB Output is correct
16 Correct 18 ms 208 KB Output is correct
17 Correct 19 ms 208 KB Output is correct
18 Correct 17 ms 208 KB Output is correct
19 Correct 16 ms 208 KB Output is correct
20 Correct 15 ms 208 KB Output is correct
21 Correct 13 ms 300 KB Output is correct
22 Correct 11 ms 208 KB Output is correct
23 Correct 192 ms 208 KB Output is correct
24 Correct 78 ms 304 KB Output is correct
25 Correct 87 ms 208 KB Output is correct
26 Correct 54 ms 288 KB Output is correct
27 Correct 192 ms 288 KB Output is correct
28 Correct 131 ms 304 KB Output is correct
29 Correct 161 ms 300 KB Output is correct
30 Correct 123 ms 292 KB Output is correct
31 Correct 83 ms 308 KB Output is correct
32 Correct 140 ms 304 KB Output is correct
33 Correct 196 ms 308 KB Output is correct
34 Correct 130 ms 208 KB Output is correct
35 Correct 125 ms 240 KB Output is correct
36 Correct 140 ms 288 KB Output is correct
37 Correct 111 ms 396 KB Output is correct
38 Correct 69 ms 308 KB Output is correct
39 Correct 103 ms 300 KB Output is correct
40 Correct 52 ms 356 KB Output is correct
41 Correct 71 ms 300 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 1 ms 208 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 0 ms 208 KB Output is correct
5 Partially correct 1 ms 208 KB Output is partially correct
6 Partially correct 2 ms 208 KB Output is partially correct
7 Incorrect 247 ms 300 KB Too many queries.
8 Halted 0 ms 0 KB -