Submission #980459

# Submission time Handle Problem Language Result Execution time Memory
980459 2024-05-12T07:41:19 Z CSQ31 Rarest Insects (IOI22_insects) C++17
57.89 / 100
85 ms 1992 KB
#include "insects.h"
#include<bits/stdc++.h>
using namespace std;
#define sz(a) (int)(a.size())
mt19937 seed(chrono::high_resolution_clock::now().time_since_epoch().count());
vector<int>dis,unknown,id;
int type[2222];
void solve(int l,int r,vector<int>v){
  if(v.empty())return;
  if(l==r){
      for(int x:v)type[x] = type[dis[l]];
      return;
  }

  int tm = (l+r)/2;
  for(int i=tm+1;i<=r;i++)move_outside(id[dis[i]]);
  ///
  vector<int>a,b;
  for(int x:v){
      move_inside(id[x]);
      if(press_button() == 2)a.push_back(x);
      else b.push_back(x);
      move_outside(id[x]);
  }
  ///
  solve(l,tm,a);
  for(int i=tm+1;i<=r;i++)move_inside(id[dis[i]]);
  if(!b.empty()){
      solve(tm+1,r,b);
  }
}
int min_cardinality(int N) {
  for(int i=0;i<N;i++)id.push_back(i);
  shuffle(id.begin(),id.end(),seed);

  for(int i=0;i<N;i++){
      move_inside(id[i]);
      if(press_button() != 1){
          move_outside(id[i]);
          unknown.push_back(i);
        }else{
          dis.push_back(i);
          type[i] = sz(dis);
        }
  }
  solve(0,sz(dis)-1,unknown);
  vector<int>cnt(N+1,0);
  int mn = N;
  
  //for(int i=0;i<N;i++)cout<<type[i]<<" ";
  //cout<<'\n';
  for(int i=0;i<N;i++)cnt[type[i]]++;
  for(int i=1;i<=sz(dis);i++)mn = min(mn,cnt[i]);
  return mn;
}
# 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 1 ms 340 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 4 ms 600 KB Output is correct
9 Correct 4 ms 448 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Correct 4 ms 600 KB Output is correct
12 Correct 3 ms 600 KB Output is correct
13 Correct 5 ms 452 KB Output is correct
14 Correct 3 ms 600 KB Output is correct
15 Correct 3 ms 600 KB Output is correct
16 Correct 4 ms 600 KB Output is correct
17 Correct 3 ms 600 KB Output is correct
18 Correct 4 ms 448 KB Output is correct
19 Correct 4 ms 852 KB Output is correct
20 Correct 5 ms 344 KB Output is correct
21 Correct 4 ms 600 KB Output is correct
22 Correct 4 ms 596 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 1 ms 340 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 4 ms 600 KB Output is correct
9 Correct 4 ms 448 KB Output is correct
10 Correct 2 ms 600 KB Output is correct
11 Correct 4 ms 600 KB Output is correct
12 Correct 3 ms 600 KB Output is correct
13 Correct 5 ms 452 KB Output is correct
14 Correct 3 ms 600 KB Output is correct
15 Correct 3 ms 600 KB Output is correct
16 Correct 4 ms 600 KB Output is correct
17 Correct 3 ms 600 KB Output is correct
18 Correct 4 ms 448 KB Output is correct
19 Correct 4 ms 852 KB Output is correct
20 Correct 5 ms 344 KB Output is correct
21 Correct 4 ms 600 KB Output is correct
22 Correct 4 ms 596 KB Output is correct
23 Correct 4 ms 600 KB Output is correct
24 Correct 4 ms 608 KB Output is correct
25 Correct 38 ms 948 KB Output is correct
26 Correct 24 ms 600 KB Output is correct
27 Correct 9 ms 944 KB Output is correct
28 Correct 25 ms 1228 KB Output is correct
29 Correct 18 ms 856 KB Output is correct
30 Correct 28 ms 856 KB Output is correct
31 Correct 17 ms 600 KB Output is correct
32 Correct 17 ms 612 KB Output is correct
33 Correct 23 ms 696 KB Output is correct
34 Correct 20 ms 952 KB Output is correct
35 Correct 25 ms 956 KB Output is correct
36 Correct 24 ms 1116 KB Output is correct
37 Correct 32 ms 952 KB Output is correct
38 Correct 34 ms 856 KB Output is correct
39 Correct 33 ms 1104 KB Output is correct
40 Correct 24 ms 600 KB Output is correct
41 Correct 20 ms 1204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 596 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 8 ms 860 KB Output is correct
8 Correct 8 ms 608 KB Output is correct
9 Partially correct 67 ms 856 KB Output is partially correct
10 Partially correct 85 ms 972 KB Output is partially correct
11 Correct 26 ms 968 KB Output is correct
12 Partially correct 65 ms 1484 KB Output is partially correct
13 Partially correct 36 ms 972 KB Output is partially correct
14 Partially correct 55 ms 1624 KB Output is partially correct
15 Partially correct 42 ms 980 KB Output is partially correct
16 Partially correct 37 ms 728 KB Output is partially correct
17 Partially correct 49 ms 728 KB Output is partially correct
18 Partially correct 49 ms 712 KB Output is partially correct
19 Partially correct 51 ms 736 KB Output is partially correct
20 Partially correct 58 ms 856 KB Output is partially correct
21 Partially correct 65 ms 720 KB Output is partially correct
22 Partially correct 79 ms 728 KB Output is partially correct
23 Partially correct 83 ms 716 KB Output is partially correct
24 Partially correct 72 ms 724 KB Output is partially correct
25 Partially correct 63 ms 716 KB Output is partially correct
26 Partially correct 54 ms 600 KB Output is partially correct
27 Partially correct 75 ms 732 KB Output is partially correct
28 Partially correct 58 ms 1108 KB Output is partially correct
29 Partially correct 64 ms 1112 KB Output is partially correct
30 Partially correct 58 ms 976 KB Output is partially correct
31 Partially correct 73 ms 888 KB Output is partially correct
32 Partially correct 64 ms 968 KB Output is partially correct
33 Partially correct 74 ms 1228 KB Output is partially correct
34 Partially correct 69 ms 980 KB Output is partially correct
35 Partially correct 61 ms 1224 KB Output is partially correct
36 Partially correct 68 ms 976 KB Output is partially correct
37 Partially correct 65 ms 1112 KB Output is partially correct
38 Partially correct 61 ms 864 KB Output is partially correct
39 Partially correct 73 ms 732 KB Output is partially correct
40 Partially correct 73 ms 1876 KB Output is partially correct
41 Partially correct 60 ms 976 KB Output is partially correct
42 Partially correct 62 ms 1464 KB Output is partially correct
43 Partially correct 9 ms 604 KB Output is partially correct
44 Partially correct 33 ms 1240 KB Output is partially correct
45 Correct 21 ms 864 KB Output is correct
46 Partially correct 52 ms 1992 KB Output is partially correct
47 Partially correct 61 ms 1492 KB Output is partially correct
48 Partially correct 56 ms 1772 KB Output is partially correct