Submission #1062433

# Submission time Handle Problem Language Result Execution time Memory
1062433 2024-08-17T06:50:33 Z Malix Rarest Insects (IOI22_insects) C++17
50 / 100
138 ms 916 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+1);
  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 0 ms 344 KB Output is correct
6 Correct 2 ms 340 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 3 ms 436 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
10 Correct 6 ms 344 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 7 ms 344 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 344 KB Output is correct
16 Correct 3 ms 440 KB Output is correct
17 Correct 5 ms 344 KB Output is correct
18 Correct 7 ms 344 KB Output is correct
19 Correct 3 ms 436 KB Output is correct
20 Correct 4 ms 344 KB Output is correct
21 Correct 5 ms 440 KB Output is correct
22 Correct 2 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 340 KB Output is correct
7 Correct 2 ms 344 KB Output is correct
8 Correct 3 ms 436 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
10 Correct 6 ms 344 KB Output is correct
11 Correct 2 ms 344 KB Output is correct
12 Correct 7 ms 344 KB Output is correct
13 Correct 5 ms 344 KB Output is correct
14 Correct 3 ms 384 KB Output is correct
15 Correct 3 ms 344 KB Output is correct
16 Correct 3 ms 440 KB Output is correct
17 Correct 5 ms 344 KB Output is correct
18 Correct 7 ms 344 KB Output is correct
19 Correct 3 ms 436 KB Output is correct
20 Correct 4 ms 344 KB Output is correct
21 Correct 5 ms 440 KB Output is correct
22 Correct 2 ms 344 KB Output is correct
23 Correct 11 ms 460 KB Output is correct
24 Correct 9 ms 432 KB Output is correct
25 Correct 14 ms 488 KB Output is correct
26 Correct 31 ms 616 KB Output is correct
27 Correct 62 ms 344 KB Output is correct
28 Correct 13 ms 692 KB Output is correct
29 Correct 52 ms 344 KB Output is correct
30 Correct 35 ms 344 KB Output is correct
31 Correct 15 ms 600 KB Output is correct
32 Correct 19 ms 728 KB Output is correct
33 Correct 17 ms 344 KB Output is correct
34 Correct 26 ms 344 KB Output is correct
35 Correct 25 ms 600 KB Output is correct
36 Correct 16 ms 340 KB Output is correct
37 Correct 22 ms 600 KB Output is correct
38 Correct 19 ms 344 KB Output is correct
39 Correct 24 ms 436 KB Output is correct
40 Correct 16 ms 436 KB Output is correct
41 Correct 6 ms 340 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 344 KB Output is correct
7 Correct 36 ms 428 KB Output is correct
8 Correct 18 ms 448 KB Output is correct
9 Correct 30 ms 600 KB Output is correct
10 Partially correct 59 ms 500 KB Output is partially correct
11 Partially correct 138 ms 436 KB Output is partially correct
12 Correct 41 ms 592 KB Output is correct
13 Partially correct 131 ms 676 KB Output is partially correct
14 Partially correct 78 ms 600 KB Output is partially correct
15 Partially correct 33 ms 916 KB Output is partially correct
16 Partially correct 35 ms 344 KB Output is partially correct
17 Partially correct 42 ms 424 KB Output is partially correct
18 Partially correct 43 ms 668 KB Output is partially correct
19 Partially correct 45 ms 688 KB Output is partially correct
20 Partially correct 36 ms 600 KB Output is partially correct
21 Partially correct 44 ms 344 KB Output is partially correct
22 Partially correct 43 ms 344 KB Output is partially correct
23 Partially correct 63 ms 344 KB Output is partially correct
24 Partially correct 48 ms 452 KB Output is partially correct
25 Correct 32 ms 592 KB Output is correct
26 Correct 19 ms 684 KB Output is correct
27 Correct 24 ms 644 KB Output is correct
28 Correct 29 ms 592 KB Output is correct
29 Correct 40 ms 424 KB Output is correct
30 Correct 32 ms 344 KB Output is correct
31 Partially correct 49 ms 848 KB Output is partially correct
32 Partially correct 51 ms 684 KB Output is partially correct
33 Partially correct 81 ms 416 KB Output is partially correct
34 Partially correct 82 ms 592 KB Output is partially correct
35 Correct 23 ms 592 KB Output is correct
36 Correct 24 ms 604 KB Output is correct
37 Partially correct 55 ms 684 KB Output is partially correct
38 Partially correct 44 ms 344 KB Output is partially correct
39 Correct 29 ms 684 KB Output is correct
40 Correct 27 ms 592 KB Output is correct
41 Correct 23 ms 592 KB Output is correct
42 Correct 29 ms 684 KB Output is correct
43 Partially correct 20 ms 344 KB Output is partially correct
44 Partially correct 109 ms 424 KB Output is partially correct
45 Correct 28 ms 528 KB Output is correct
46 Correct 28 ms 344 KB Output is correct
47 Correct 28 ms 344 KB Output is correct
48 Correct 26 ms 460 KB Output is correct