답안 #980456

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
980456 2024-05-12T07:40:42 Z CSQ31 드문 곤충 (IOI22_insects) C++17
57.92 / 100
95 ms 1512 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 2 ms 344 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 5 ms 452 KB Output is correct
9 Correct 5 ms 600 KB Output is correct
10 Correct 3 ms 448 KB Output is correct
11 Correct 4 ms 456 KB Output is correct
12 Correct 4 ms 600 KB Output is correct
13 Correct 5 ms 452 KB Output is correct
14 Correct 4 ms 452 KB Output is correct
15 Correct 3 ms 448 KB Output is correct
16 Correct 5 ms 600 KB Output is correct
17 Correct 5 ms 600 KB Output is correct
18 Correct 6 ms 452 KB Output is correct
19 Correct 7 ms 600 KB Output is correct
20 Correct 5 ms 444 KB Output is correct
21 Correct 4 ms 448 KB Output is correct
22 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 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 2 ms 344 KB Output is correct
7 Correct 1 ms 596 KB Output is correct
8 Correct 5 ms 452 KB Output is correct
9 Correct 5 ms 600 KB Output is correct
10 Correct 3 ms 448 KB Output is correct
11 Correct 4 ms 456 KB Output is correct
12 Correct 4 ms 600 KB Output is correct
13 Correct 5 ms 452 KB Output is correct
14 Correct 4 ms 452 KB Output is correct
15 Correct 3 ms 448 KB Output is correct
16 Correct 5 ms 600 KB Output is correct
17 Correct 5 ms 600 KB Output is correct
18 Correct 6 ms 452 KB Output is correct
19 Correct 7 ms 600 KB Output is correct
20 Correct 5 ms 444 KB Output is correct
21 Correct 4 ms 448 KB Output is correct
22 Correct 3 ms 344 KB Output is correct
23 Correct 5 ms 600 KB Output is correct
24 Correct 5 ms 856 KB Output is correct
25 Correct 28 ms 856 KB Output is correct
26 Correct 25 ms 704 KB Output is correct
27 Correct 10 ms 712 KB Output is correct
28 Correct 30 ms 856 KB Output is correct
29 Correct 18 ms 856 KB Output is correct
30 Correct 31 ms 716 KB Output is correct
31 Correct 16 ms 608 KB Output is correct
32 Correct 21 ms 600 KB Output is correct
33 Correct 22 ms 712 KB Output is correct
34 Correct 30 ms 592 KB Output is correct
35 Correct 25 ms 1364 KB Output is correct
36 Correct 27 ms 852 KB Output is correct
37 Correct 44 ms 688 KB Output is correct
38 Correct 35 ms 708 KB Output is correct
39 Correct 33 ms 708 KB Output is correct
40 Correct 26 ms 956 KB Output is correct
41 Correct 23 ms 856 KB Output is correct
# 결과 실행 시간 메모리 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 1 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 8 ms 720 KB Output is correct
8 Correct 7 ms 856 KB Output is correct
9 Partially correct 74 ms 1116 KB Output is partially correct
10 Partially correct 64 ms 728 KB Output is partially correct
11 Correct 21 ms 700 KB Output is correct
12 Partially correct 62 ms 1020 KB Output is partially correct
13 Partially correct 34 ms 1144 KB Output is partially correct
14 Partially correct 65 ms 1480 KB Output is partially correct
15 Partially correct 31 ms 1200 KB Output is partially correct
16 Partially correct 46 ms 724 KB Output is partially correct
17 Partially correct 46 ms 856 KB Output is partially correct
18 Partially correct 48 ms 972 KB Output is partially correct
19 Partially correct 61 ms 976 KB Output is partially correct
20 Partially correct 43 ms 1484 KB Output is partially correct
21 Partially correct 72 ms 968 KB Output is partially correct
22 Partially correct 66 ms 1116 KB Output is partially correct
23 Partially correct 68 ms 1232 KB Output is partially correct
24 Partially correct 62 ms 1228 KB Output is partially correct
25 Partially correct 54 ms 972 KB Output is partially correct
26 Partially correct 42 ms 856 KB Output is partially correct
27 Partially correct 67 ms 1360 KB Output is partially correct
28 Partially correct 58 ms 856 KB Output is partially correct
29 Partially correct 50 ms 856 KB Output is partially correct
30 Partially correct 59 ms 708 KB Output is partially correct
31 Partially correct 63 ms 972 KB Output is partially correct
32 Partially correct 81 ms 948 KB Output is partially correct
33 Partially correct 66 ms 876 KB Output is partially correct
34 Partially correct 95 ms 1000 KB Output is partially correct
35 Partially correct 62 ms 1124 KB Output is partially correct
36 Partially correct 61 ms 1132 KB Output is partially correct
37 Partially correct 64 ms 1236 KB Output is partially correct
38 Partially correct 74 ms 960 KB Output is partially correct
39 Partially correct 63 ms 964 KB Output is partially correct
40 Partially correct 64 ms 716 KB Output is partially correct
41 Partially correct 61 ms 716 KB Output is partially correct
42 Partially correct 75 ms 736 KB Output is partially correct
43 Partially correct 8 ms 856 KB Output is partially correct
44 Partially correct 36 ms 980 KB Output is partially correct
45 Correct 20 ms 1112 KB Output is correct
46 Partially correct 63 ms 1020 KB Output is partially correct
47 Partially correct 56 ms 1512 KB Output is partially correct
48 Partially correct 59 ms 1272 KB Output is partially correct