# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1024472 | 2024-07-16T05:43:28 Z | vjudge1 | 드문 곤충 (IOI22_insects) | C++17 | 118 ms | 1120 KB |
#include <bits/stdc++.h> #define ent '\n' void move_inside(int i); void move_outside(int i); int press_button(); using namespace std; typedef long long ll; const int maxn = 1e5 + 12; struct Q{ int mid, l, r, i; }; int cnt[maxn]; bool is[maxn]; int p[maxn]; int min_cardinality(int n){ vector<Q> q; vector<int> u; for(int i=0;i<n;i++){ move_inside(i); if(press_button() != 1){ move_outside(i); int l = 0, r = (int)u.size() - 1, mid = l + r >> 1; q.push_back({mid, l, r, i}); } else{ u.push_back(i); is[i] = 1; p[i] = i; } } for(int i=0;i<u.size();i++){ move_outside(u[i]); } while(q.size()){ vector<Q> nq; sort(q.begin(), q.end(), [](Q x, Q y){ return x.mid < y.mid; }); int ptr = 0; vector<int> v; for(auto [mid, l, r, i]:q){ while(ptr <= mid){ v.push_back(u[ptr]); move_inside(u[ptr]); ptr++; } move_inside(i); if(press_button() != 1){ r = mid - 1; p[i] = u[mid]; } else l = mid + 1; move_outside(i); if(l <= r){ int nmid = l + r >> 1; nq.push_back({nmid, l, r, i}); } } while(v.size()){ move_outside(v.back()); v.pop_back(); } q.swap(nq); } for(int i=0;i<n;i++){ cnt[p[i]]++; } int ans = 1e9; for(int i=0;i<n;i++){ if(p[i] == i){ ans = min(ans, cnt[i]); } } return ans; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | 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 | 340 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 3 ms | 452 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 5 ms | 460 KB | Output is correct |
9 | Correct | 3 ms | 344 KB | Output is correct |
10 | Correct | 4 ms | 344 KB | Output is correct |
11 | Correct | 4 ms | 456 KB | Output is correct |
12 | Correct | 3 ms | 452 KB | Output is correct |
13 | Correct | 5 ms | 452 KB | Output is correct |
14 | Correct | 3 ms | 344 KB | Output is correct |
15 | Correct | 4 ms | 344 KB | Output is correct |
16 | Correct | 3 ms | 344 KB | Output is correct |
17 | Correct | 3 ms | 344 KB | Output is correct |
18 | Correct | 5 ms | 460 KB | Output is correct |
19 | Correct | 4 ms | 464 KB | Output is correct |
20 | Correct | 5 ms | 344 KB | Output is correct |
21 | Correct | 4 ms | 344 KB | Output is correct |
22 | Correct | 4 ms | 344 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 | 340 KB | Output is correct |
5 | Correct | 0 ms | 344 KB | Output is correct |
6 | Correct | 3 ms | 452 KB | Output is correct |
7 | Correct | 1 ms | 344 KB | Output is correct |
8 | Correct | 5 ms | 460 KB | Output is correct |
9 | Correct | 3 ms | 344 KB | Output is correct |
10 | Correct | 4 ms | 344 KB | Output is correct |
11 | Correct | 4 ms | 456 KB | Output is correct |
12 | Correct | 3 ms | 452 KB | Output is correct |
13 | Correct | 5 ms | 452 KB | Output is correct |
14 | Correct | 3 ms | 344 KB | Output is correct |
15 | Correct | 4 ms | 344 KB | Output is correct |
16 | Correct | 3 ms | 344 KB | Output is correct |
17 | Correct | 3 ms | 344 KB | Output is correct |
18 | Correct | 5 ms | 460 KB | Output is correct |
19 | Correct | 4 ms | 464 KB | Output is correct |
20 | Correct | 5 ms | 344 KB | Output is correct |
21 | Correct | 4 ms | 344 KB | Output is correct |
22 | Correct | 4 ms | 344 KB | Output is correct |
23 | Correct | 10 ms | 344 KB | Output is correct |
24 | Correct | 6 ms | 344 KB | Output is correct |
25 | Correct | 35 ms | 856 KB | Output is correct |
26 | Correct | 32 ms | 480 KB | Output is correct |
27 | Correct | 8 ms | 344 KB | Output is correct |
28 | Correct | 16 ms | 344 KB | Output is correct |
29 | Correct | 18 ms | 592 KB | Output is correct |
30 | Correct | 39 ms | 600 KB | Output is correct |
31 | Correct | 11 ms | 484 KB | Output is correct |
32 | Correct | 26 ms | 708 KB | Output is correct |
33 | Correct | 27 ms | 740 KB | Output is correct |
34 | Correct | 21 ms | 592 KB | Output is correct |
35 | Correct | 23 ms | 496 KB | Output is correct |
36 | Correct | 25 ms | 592 KB | Output is correct |
37 | Correct | 34 ms | 504 KB | Output is correct |
38 | Correct | 50 ms | 648 KB | Output is correct |
39 | Correct | 31 ms | 592 KB | Output is correct |
40 | Correct | 37 ms | 600 KB | Output is correct |
41 | Correct | 19 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 | 0 ms | 344 KB | Output is correct |
7 | Correct | 15 ms | 452 KB | Output is correct |
8 | Correct | 9 ms | 448 KB | Output is correct |
9 | Partially correct | 74 ms | 968 KB | Output is partially correct |
10 | Partially correct | 81 ms | 344 KB | Output is partially correct |
11 | Correct | 31 ms | 344 KB | Output is correct |
12 | Partially correct | 52 ms | 484 KB | Output is partially correct |
13 | Partially correct | 47 ms | 1120 KB | Output is partially correct |
14 | Partially correct | 70 ms | 600 KB | Output is partially correct |
15 | Partially correct | 28 ms | 596 KB | Output is partially correct |
16 | Partially correct | 36 ms | 592 KB | Output is partially correct |
17 | Partially correct | 51 ms | 592 KB | Output is partially correct |
18 | Partially correct | 70 ms | 776 KB | Output is partially correct |
19 | Partially correct | 58 ms | 600 KB | Output is partially correct |
20 | Partially correct | 56 ms | 704 KB | Output is partially correct |
21 | Partially correct | 82 ms | 736 KB | Output is partially correct |
22 | Partially correct | 91 ms | 544 KB | Output is partially correct |
23 | Partially correct | 118 ms | 736 KB | Output is partially correct |
24 | Partially correct | 96 ms | 540 KB | Output is partially correct |
25 | Partially correct | 83 ms | 512 KB | Output is partially correct |
26 | Partially correct | 46 ms | 744 KB | Output is partially correct |
27 | Partially correct | 70 ms | 800 KB | Output is partially correct |
28 | Partially correct | 78 ms | 508 KB | Output is partially correct |
29 | Partially correct | 74 ms | 856 KB | Output is partially correct |
30 | Partially correct | 74 ms | 600 KB | Output is partially correct |
31 | Partially correct | 68 ms | 560 KB | Output is partially correct |
32 | Partially correct | 91 ms | 780 KB | Output is partially correct |
33 | Partially correct | 93 ms | 536 KB | Output is partially correct |
34 | Partially correct | 96 ms | 856 KB | Output is partially correct |
35 | Partially correct | 94 ms | 524 KB | Output is partially correct |
36 | Partially correct | 71 ms | 748 KB | Output is partially correct |
37 | Partially correct | 75 ms | 560 KB | Output is partially correct |
38 | Partially correct | 73 ms | 556 KB | Output is partially correct |
39 | Partially correct | 86 ms | 724 KB | Output is partially correct |
40 | Partially correct | 84 ms | 780 KB | Output is partially correct |
41 | Partially correct | 75 ms | 760 KB | Output is partially correct |
42 | Partially correct | 77 ms | 544 KB | Output is partially correct |
43 | Partially correct | 8 ms | 492 KB | Output is partially correct |
44 | Partially correct | 34 ms | 536 KB | Output is partially correct |
45 | Correct | 31 ms | 344 KB | Output is correct |
46 | Correct | 14 ms | 472 KB | Output is correct |
47 | Partially correct | 75 ms | 656 KB | Output is partially correct |
48 | Partially correct | 51 ms | 956 KB | Output is partially correct |