답안 #1062567

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1062567 2024-08-17T08:39:50 Z Malix 드문 곤충 (IOI22_insects) C++17
38.27 / 100
242 ms 1180 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,m+(n-p)/k);
  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;
}
# 결과 실행 시간 메모리 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 3 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 6 ms 600 KB Output is correct
10 Correct 7 ms 600 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 11 ms 344 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Correct 3 ms 436 KB Output is correct
15 Correct 3 ms 344 KB Output is correct
16 Correct 4 ms 444 KB Output is correct
17 Correct 6 ms 344 KB Output is correct
18 Correct 9 ms 416 KB Output is correct
19 Correct 5 ms 436 KB Output is correct
20 Correct 5 ms 344 KB Output is correct
21 Correct 2 ms 440 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
# 결과 실행 시간 메모리 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 3 ms 344 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 4 ms 344 KB Output is correct
9 Correct 6 ms 600 KB Output is correct
10 Correct 7 ms 600 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 11 ms 344 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Correct 3 ms 436 KB Output is correct
15 Correct 3 ms 344 KB Output is correct
16 Correct 4 ms 444 KB Output is correct
17 Correct 6 ms 344 KB Output is correct
18 Correct 9 ms 416 KB Output is correct
19 Correct 5 ms 436 KB Output is correct
20 Correct 5 ms 344 KB Output is correct
21 Correct 2 ms 440 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 17 ms 600 KB Output is correct
24 Correct 5 ms 344 KB Output is correct
25 Correct 14 ms 600 KB Output is correct
26 Correct 16 ms 448 KB Output is correct
27 Correct 45 ms 344 KB Output is correct
28 Correct 6 ms 344 KB Output is correct
29 Correct 76 ms 344 KB Output is correct
30 Correct 48 ms 448 KB Output is correct
31 Correct 18 ms 456 KB Output is correct
32 Correct 19 ms 600 KB Output is correct
33 Correct 20 ms 696 KB Output is correct
34 Correct 24 ms 740 KB Output is correct
35 Correct 16 ms 496 KB Output is correct
36 Correct 32 ms 696 KB Output is correct
37 Correct 30 ms 600 KB Output is correct
38 Correct 31 ms 696 KB Output is correct
39 Correct 19 ms 344 KB Output is correct
40 Correct 9 ms 436 KB Output is correct
41 Correct 6 ms 344 KB Output is correct
# 결과 실행 시간 메모리 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 41 ms 956 KB Output is correct
8 Correct 12 ms 344 KB Output is correct
9 Correct 27 ms 864 KB Output is correct
10 Partially correct 132 ms 716 KB Output is partially correct
11 Partially correct 149 ms 424 KB Output is partially correct
12 Correct 15 ms 344 KB Output is correct
13 Partially correct 242 ms 444 KB Output is partially correct
14 Partially correct 82 ms 408 KB Output is partially correct
15 Partially correct 38 ms 684 KB Output is partially correct
16 Partially correct 39 ms 592 KB Output is partially correct
17 Partially correct 42 ms 344 KB Output is partially correct
18 Partially correct 68 ms 848 KB Output is partially correct
19 Partially correct 36 ms 476 KB Output is partially correct
20 Partially correct 63 ms 428 KB Output is partially correct
21 Partially correct 80 ms 656 KB Output is partially correct
22 Partially correct 81 ms 600 KB Output is partially correct
23 Partially correct 81 ms 424 KB Output is partially correct
24 Correct 36 ms 700 KB Output is correct
25 Correct 15 ms 344 KB Output is correct
26 Correct 13 ms 344 KB Output is correct
27 Correct 23 ms 692 KB Output is correct
28 Correct 27 ms 688 KB Output is correct
29 Correct 30 ms 592 KB Output is correct
30 Correct 35 ms 560 KB Output is correct
31 Partially correct 106 ms 676 KB Output is partially correct
32 Partially correct 94 ms 528 KB Output is partially correct
33 Partially correct 115 ms 464 KB Output is partially correct
34 Partially correct 120 ms 592 KB Output is partially correct
35 Correct 32 ms 716 KB Output is correct
36 Correct 22 ms 344 KB Output is correct
37 Partially correct 47 ms 592 KB Output is partially correct
38 Partially correct 45 ms 592 KB Output is partially correct
39 Correct 21 ms 1024 KB Output is correct
40 Correct 34 ms 708 KB Output is correct
41 Correct 22 ms 592 KB Output is correct
42 Correct 32 ms 440 KB Output is correct
43 Partially correct 21 ms 344 KB Output is partially correct
44 Partially correct 109 ms 344 KB Output is partially correct
45 Correct 30 ms 1180 KB Output is correct
46 Correct 29 ms 412 KB Output is correct
47 Correct 23 ms 684 KB Output is correct
48 Correct 23 ms 432 KB Output is correct