Submission #1062437

# Submission time Handle Problem Language Result Execution time Memory
1062437 2024-08-17T06:52:08 Z Malix Rarest Insects (IOI22_insects) C++17
50 / 100
124 ms 1692 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 r=N/k;
  int ans=BS(1,r);
  return ans;
}
# 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 4 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 436 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Correct 9 ms 436 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 7 ms 380 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 4 ms 600 KB Output is correct
16 Correct 3 ms 344 KB Output is correct
17 Correct 4 ms 344 KB Output is correct
18 Correct 5 ms 344 KB Output is correct
19 Correct 3 ms 440 KB Output is correct
20 Correct 4 ms 344 KB Output is correct
21 Correct 2 ms 344 KB Output is correct
22 Correct 1 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 4 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 436 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Correct 9 ms 436 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 7 ms 380 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Correct 5 ms 344 KB Output is correct
15 Correct 4 ms 600 KB Output is correct
16 Correct 3 ms 344 KB Output is correct
17 Correct 4 ms 344 KB Output is correct
18 Correct 5 ms 344 KB Output is correct
19 Correct 3 ms 440 KB Output is correct
20 Correct 4 ms 344 KB Output is correct
21 Correct 2 ms 344 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 15 ms 592 KB Output is correct
24 Correct 4 ms 344 KB Output is correct
25 Correct 12 ms 492 KB Output is correct
26 Correct 18 ms 600 KB Output is correct
27 Correct 67 ms 344 KB Output is correct
28 Correct 4 ms 344 KB Output is correct
29 Correct 46 ms 444 KB Output is correct
30 Correct 34 ms 600 KB Output is correct
31 Correct 20 ms 460 KB Output is correct
32 Correct 19 ms 476 KB Output is correct
33 Correct 13 ms 344 KB Output is correct
34 Correct 23 ms 684 KB Output is correct
35 Correct 12 ms 344 KB Output is correct
36 Correct 18 ms 600 KB Output is correct
37 Correct 17 ms 344 KB Output is correct
38 Correct 19 ms 344 KB Output is correct
39 Correct 15 ms 436 KB Output is correct
40 Correct 11 ms 440 KB Output is correct
41 Correct 6 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 1 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 25 ms 828 KB Output is correct
8 Correct 6 ms 344 KB Output is correct
9 Correct 25 ms 476 KB Output is correct
10 Partially correct 62 ms 432 KB Output is partially correct
11 Partially correct 124 ms 344 KB Output is partially correct
12 Correct 17 ms 696 KB Output is correct
13 Partially correct 112 ms 592 KB Output is partially correct
14 Partially correct 85 ms 716 KB Output is partially correct
15 Partially correct 38 ms 600 KB Output is partially correct
16 Partially correct 35 ms 436 KB Output is partially correct
17 Partially correct 33 ms 532 KB Output is partially correct
18 Partially correct 43 ms 596 KB Output is partially correct
19 Partially correct 46 ms 776 KB Output is partially correct
20 Partially correct 37 ms 600 KB Output is partially correct
21 Partially correct 49 ms 344 KB Output is partially correct
22 Partially correct 53 ms 592 KB Output is partially correct
23 Partially correct 54 ms 592 KB Output is partially correct
24 Correct 39 ms 592 KB Output is correct
25 Correct 26 ms 468 KB Output is correct
26 Correct 10 ms 344 KB Output is correct
27 Correct 21 ms 788 KB Output is correct
28 Correct 28 ms 456 KB Output is correct
29 Correct 23 ms 592 KB Output is correct
30 Correct 36 ms 1692 KB Output is correct
31 Partially correct 60 ms 620 KB Output is partially correct
32 Partially correct 59 ms 432 KB Output is partially correct
33 Partially correct 67 ms 428 KB Output is partially correct
34 Partially correct 77 ms 692 KB Output is partially correct
35 Correct 29 ms 412 KB Output is correct
36 Correct 39 ms 428 KB Output is correct
37 Partially correct 45 ms 432 KB Output is partially correct
38 Partially correct 49 ms 848 KB Output is partially correct
39 Correct 29 ms 848 KB Output is correct
40 Correct 28 ms 536 KB Output is correct
41 Correct 27 ms 432 KB Output is correct
42 Correct 30 ms 460 KB Output is correct
43 Partially correct 18 ms 440 KB Output is partially correct
44 Partially correct 110 ms 344 KB Output is partially correct
45 Correct 40 ms 668 KB Output is correct
46 Correct 18 ms 344 KB Output is correct
47 Correct 24 ms 688 KB Output is correct
48 Correct 18 ms 592 KB Output is correct