# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1064218 | 2024-08-18T10:30:11 Z | MarwenElarbi | 드문 곤충 (IOI22_insects) | C++17 | 98 ms | 1272 KB |
#include <bits/stdc++.h> #include "insects.h" using namespace std; #define pb push_back #define ll long long #define fi first #define se second mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int nax=2005; int sz[nax]; vector<int> insects; vector<int> to_do[nax]; int ls=0; int rs=-1; int c=0; void daq(int l,int r){ if(l==r){ sz[l]+=to_do[l].size(); return; } int mid=(r+l)/2; while(ls<l){ c--; move_outside(insects[ls++]); } while(ls>l){ c++; move_inside(insects[--ls]); } while(rs<mid){ c++; move_inside(insects[++rs]); } while(rs>mid){ c--; move_outside(insects[rs--]); } vector<int> left,right; for(auto u:to_do[mid]){ move_inside(u); int a=press_button(); if(a==2) left.pb(u); else right.pb(u); move_outside(u); } to_do[(mid+l)/2]=left; to_do[(mid+1+r)/2]=right; if(to_do[(mid+l)/2].size()) daq(l,mid); if(to_do[(mid+1+r)/2].size()) daq(mid+1,r); return; } int min_cardinality(int N){ int n=N; move_inside(0); insects.pb(0); int cnt=1; vector<int> cur; for (int i = 1; i < n; ++i) { move_inside(i); cnt++; int a=press_button(); if(a==2){ if(cnt<=2) sz[0]++; else{ cur.pb(i); } move_outside(i); cnt--; }else{ insects.pb(i); } } for(auto u:cur) to_do[(insects.size()-1)/2].pb(u); for (int i = 0; i < insects.size(); ++i) { move_outside(insects[i]); } daq(0,insects.size()-1); int mn=1e9; for (int i = 0; i < insects.size(); ++i) { mn=min(mn,sz[i]); } return mn+1; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 1 ms | 344 KB | Output is correct |
8 | Correct | 4 ms | 492 KB | Output is correct |
9 | Correct | 4 ms | 496 KB | Output is correct |
10 | Correct | 2 ms | 344 KB | Output is correct |
11 | Correct | 4 ms | 496 KB | Output is correct |
12 | Correct | 3 ms | 344 KB | Output is correct |
13 | Correct | 4 ms | 344 KB | Output is correct |
14 | Correct | 4 ms | 496 KB | Output is correct |
15 | Correct | 5 ms | 600 KB | Output is correct |
16 | Correct | 4 ms | 344 KB | Output is correct |
17 | Correct | 4 ms | 500 KB | Output is correct |
18 | Correct | 4 ms | 492 KB | Output is correct |
19 | Correct | 4 ms | 344 KB | Output is correct |
20 | Correct | 5 ms | 344 KB | Output is correct |
21 | Correct | 6 ms | 496 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 | 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 | 1 ms | 344 KB | Output is correct |
8 | Correct | 4 ms | 492 KB | Output is correct |
9 | Correct | 4 ms | 496 KB | Output is correct |
10 | Correct | 2 ms | 344 KB | Output is correct |
11 | Correct | 4 ms | 496 KB | Output is correct |
12 | Correct | 3 ms | 344 KB | Output is correct |
13 | Correct | 4 ms | 344 KB | Output is correct |
14 | Correct | 4 ms | 496 KB | Output is correct |
15 | Correct | 5 ms | 600 KB | Output is correct |
16 | Correct | 4 ms | 344 KB | Output is correct |
17 | Correct | 4 ms | 500 KB | Output is correct |
18 | Correct | 4 ms | 492 KB | Output is correct |
19 | Correct | 4 ms | 344 KB | Output is correct |
20 | Correct | 5 ms | 344 KB | Output is correct |
21 | Correct | 6 ms | 496 KB | Output is correct |
22 | Correct | 3 ms | 344 KB | Output is correct |
23 | Correct | 4 ms | 344 KB | Output is correct |
24 | Correct | 3 ms | 344 KB | Output is correct |
25 | Correct | 31 ms | 496 KB | Output is correct |
26 | Correct | 36 ms | 496 KB | Output is correct |
27 | Correct | 7 ms | 344 KB | Output is correct |
28 | Correct | 41 ms | 492 KB | Output is correct |
29 | Correct | 15 ms | 516 KB | Output is correct |
30 | Correct | 35 ms | 760 KB | Output is correct |
31 | Correct | 12 ms | 504 KB | Output is correct |
32 | Correct | 26 ms | 600 KB | Output is correct |
33 | Correct | 22 ms | 344 KB | Output is correct |
34 | Correct | 23 ms | 728 KB | Output is correct |
35 | Correct | 19 ms | 492 KB | Output is correct |
36 | Correct | 29 ms | 764 KB | Output is correct |
37 | Correct | 32 ms | 732 KB | Output is correct |
38 | Correct | 37 ms | 496 KB | Output is correct |
39 | Correct | 34 ms | 508 KB | Output is correct |
40 | Correct | 31 ms | 752 KB | Output is correct |
41 | Correct | 23 ms | 600 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 | 0 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 | 11 ms | 344 KB | Output is correct |
8 | Correct | 11 ms | 500 KB | Output is correct |
9 | Partially correct | 65 ms | 600 KB | Output is partially correct |
10 | Partially correct | 86 ms | 1104 KB | Output is partially correct |
11 | Correct | 14 ms | 500 KB | Output is correct |
12 | Partially correct | 76 ms | 600 KB | Output is partially correct |
13 | Partially correct | 33 ms | 604 KB | Output is partially correct |
14 | Partially correct | 83 ms | 600 KB | Output is partially correct |
15 | Partially correct | 28 ms | 740 KB | Output is partially correct |
16 | Partially correct | 46 ms | 496 KB | Output is partially correct |
17 | Partially correct | 42 ms | 496 KB | Output is partially correct |
18 | Partially correct | 52 ms | 776 KB | Output is partially correct |
19 | Partially correct | 61 ms | 496 KB | Output is partially correct |
20 | Partially correct | 58 ms | 760 KB | Output is partially correct |
21 | Partially correct | 80 ms | 1252 KB | Output is partially correct |
22 | Partially correct | 71 ms | 788 KB | Output is partially correct |
23 | Partially correct | 94 ms | 600 KB | Output is partially correct |
24 | Partially correct | 98 ms | 1004 KB | Output is partially correct |
25 | Partially correct | 67 ms | 520 KB | Output is partially correct |
26 | Partially correct | 62 ms | 776 KB | Output is partially correct |
27 | Partially correct | 77 ms | 848 KB | Output is partially correct |
28 | Partially correct | 71 ms | 1248 KB | Output is partially correct |
29 | Partially correct | 68 ms | 532 KB | Output is partially correct |
30 | Partially correct | 60 ms | 532 KB | Output is partially correct |
31 | Partially correct | 77 ms | 752 KB | Output is partially correct |
32 | Partially correct | 63 ms | 592 KB | Output is partially correct |
33 | Partially correct | 95 ms | 1272 KB | Output is partially correct |
34 | Partially correct | 76 ms | 796 KB | Output is partially correct |
35 | Partially correct | 84 ms | 744 KB | Output is partially correct |
36 | Partially correct | 87 ms | 988 KB | Output is partially correct |
37 | Partially correct | 76 ms | 768 KB | Output is partially correct |
38 | Partially correct | 71 ms | 1020 KB | Output is partially correct |
39 | Partially correct | 96 ms | 596 KB | Output is partially correct |
40 | Partially correct | 78 ms | 1148 KB | Output is partially correct |
41 | Partially correct | 68 ms | 592 KB | Output is partially correct |
42 | Partially correct | 89 ms | 1008 KB | Output is partially correct |
43 | Partially correct | 9 ms | 344 KB | Output is partially correct |
44 | Partially correct | 53 ms | 600 KB | Output is partially correct |
45 | Correct | 17 ms | 596 KB | Output is correct |
46 | Correct | 9 ms | 344 KB | Output is correct |
47 | Partially correct | 57 ms | 744 KB | Output is partially correct |
48 | Partially correct | 40 ms | 584 KB | Output is partially correct |