Submission #1056456

# Submission time Handle Problem Language Result Execution time Memory
1056456 2024-08-13T09:30:40 Z Malix Rarest Insects (IOI22_insects) C++17
47.5 / 100
153 ms 1080 KB
#include "insects.h"
#include <bits/stdc++.h>
using namespace std;
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vii;
typedef pair<int,int> pi;
typedef vector<pi> pii;
typedef tuple<int,int,int> tii;
typedef vector<ll> li;
typedef vector<li> lii;
 
#define REP(i,a,b) for(int i=a;i<b;i++)
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define LSOne(s) ((s)&(-s))
 
ll INF=1e18+10;
int inf=1e9+10;
ll M=1e9+7;

set<int> s,t;
int n;
int k=0;

int BS(int l,int r){
  if(l==r)return l;
  t=s;
  int m=(l+r)/2+1;
  REP(i,0,n){
    if(s.count(i))continue;
    s.insert(i);
    move_inside(i);
    if(press_button()<=m)continue;
    s.erase(i);
    move_outside(i);
  }
  int p=s.size();
  if(p==m*k)return BS(m,r);
  else {
    for(auto u:s)if(t.count(u)==0)move_outside(u);
    s=t;
    return BS(l,m-1);
  }
}

int min_cardinality(int N) {
  n=N;
  REP(i,0,n){
    move_inside(i);k++;
    if(press_button()>1){
      move_outside(i);k--;
    }
  }
  int ans=BS(1,2000);
  return ans;
}
# 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 1 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 8 ms 344 KB Output is correct
8 Correct 8 ms 444 KB Output is correct
9 Correct 9 ms 344 KB Output is correct
10 Correct 14 ms 344 KB Output is correct
11 Correct 6 ms 344 KB Output is correct
12 Correct 9 ms 344 KB Output is correct
13 Correct 9 ms 344 KB Output is correct
14 Correct 6 ms 688 KB Output is correct
15 Correct 7 ms 444 KB Output is correct
16 Correct 11 ms 600 KB Output is correct
17 Correct 10 ms 444 KB Output is correct
18 Correct 10 ms 344 KB Output is correct
19 Correct 7 ms 600 KB Output is correct
20 Correct 9 ms 344 KB Output is correct
21 Correct 9 ms 344 KB Output is correct
22 Correct 9 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 1 ms 344 KB Output is correct
6 Correct 4 ms 344 KB Output is correct
7 Correct 8 ms 344 KB Output is correct
8 Correct 8 ms 444 KB Output is correct
9 Correct 9 ms 344 KB Output is correct
10 Correct 14 ms 344 KB Output is correct
11 Correct 6 ms 344 KB Output is correct
12 Correct 9 ms 344 KB Output is correct
13 Correct 9 ms 344 KB Output is correct
14 Correct 6 ms 688 KB Output is correct
15 Correct 7 ms 444 KB Output is correct
16 Correct 11 ms 600 KB Output is correct
17 Correct 10 ms 444 KB Output is correct
18 Correct 10 ms 344 KB Output is correct
19 Correct 7 ms 600 KB Output is correct
20 Correct 9 ms 344 KB Output is correct
21 Correct 9 ms 344 KB Output is correct
22 Correct 9 ms 344 KB Output is correct
23 Correct 13 ms 344 KB Output is correct
24 Correct 56 ms 436 KB Output is correct
25 Correct 27 ms 500 KB Output is correct
26 Correct 42 ms 600 KB Output is correct
27 Correct 53 ms 600 KB Output is correct
28 Correct 66 ms 344 KB Output is correct
29 Correct 47 ms 344 KB Output is correct
30 Correct 54 ms 432 KB Output is correct
31 Correct 28 ms 464 KB Output is correct
32 Correct 30 ms 716 KB Output is correct
33 Correct 29 ms 600 KB Output is correct
34 Correct 33 ms 716 KB Output is correct
35 Correct 37 ms 668 KB Output is correct
36 Correct 54 ms 696 KB Output is correct
37 Correct 49 ms 344 KB Output is correct
38 Correct 51 ms 436 KB Output is correct
39 Correct 45 ms 344 KB Output is correct
40 Correct 63 ms 472 KB Output is correct
41 Correct 56 ms 592 KB Output is correct
# 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 0 ms 344 KB Output is partially correct
4 Partially correct 0 ms 344 KB Output is partially correct
5 Partially correct 0 ms 344 KB Output is partially correct
6 Partially correct 1 ms 344 KB Output is partially correct
7 Correct 23 ms 592 KB Output is correct
8 Partially correct 115 ms 940 KB Output is partially correct
9 Partially correct 65 ms 752 KB Output is partially correct
10 Partially correct 110 ms 904 KB Output is partially correct
11 Partially correct 114 ms 692 KB Output is partially correct
12 Partially correct 115 ms 748 KB Output is partially correct
13 Partially correct 122 ms 516 KB Output is partially correct
14 Partially correct 131 ms 460 KB Output is partially correct
15 Partially correct 55 ms 692 KB Output is partially correct
16 Partially correct 44 ms 500 KB Output is partially correct
17 Partially correct 74 ms 748 KB Output is partially correct
18 Partially correct 56 ms 620 KB Output is partially correct
19 Partially correct 63 ms 752 KB Output is partially correct
20 Partially correct 76 ms 580 KB Output is partially correct
21 Partially correct 114 ms 592 KB Output is partially correct
22 Partially correct 110 ms 748 KB Output is partially correct
23 Partially correct 123 ms 800 KB Output is partially correct
24 Partially correct 108 ms 600 KB Output is partially correct
25 Partially correct 132 ms 968 KB Output is partially correct
26 Partially correct 126 ms 688 KB Output is partially correct
27 Partially correct 95 ms 748 KB Output is partially correct
28 Partially correct 99 ms 504 KB Output is partially correct
29 Partially correct 55 ms 508 KB Output is partially correct
30 Partially correct 62 ms 672 KB Output is partially correct
31 Partially correct 102 ms 520 KB Output is partially correct
32 Partially correct 92 ms 960 KB Output is partially correct
33 Partially correct 153 ms 744 KB Output is partially correct
34 Partially correct 124 ms 1080 KB Output is partially correct
35 Partially correct 105 ms 728 KB Output is partially correct
36 Partially correct 94 ms 600 KB Output is partially correct
37 Partially correct 97 ms 748 KB Output is partially correct
38 Partially correct 103 ms 544 KB Output is partially correct
39 Partially correct 86 ms 788 KB Output is partially correct
40 Partially correct 117 ms 688 KB Output is partially correct
41 Partially correct 53 ms 744 KB Output is partially correct
42 Partially correct 66 ms 596 KB Output is partially correct
43 Partially correct 27 ms 688 KB Output is partially correct
44 Partially correct 115 ms 472 KB Output is partially correct
45 Partially correct 33 ms 580 KB Output is partially correct
46 Partially correct 123 ms 760 KB Output is partially correct
47 Partially correct 123 ms 1004 KB Output is partially correct
48 Partially correct 123 ms 736 KB Output is partially correct