| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 (추가 시간 없음) | 1024 MB | 89 | 36 | 33 | 42.308% |
A minimum binary heap, often simply referred to as a "min-heap," is a specialized type of binary tree-based data structure used in computer science. It is a binary tree that has two main properties:
Min-heaps are often used to implement priority queues, which are data structures that maintain a collection of elements with associated priorities. By keeping the minimum element at the root, min-heaps can quickly retrieve and remove the element with the highest priority (lowest value) in logarithmic time. However, removing any other element from a min-heap may need linear time.
Hank recently learned min-heaps. He wonders how many nodes can keep the $k$-th smallest element in a min-heap of $n$-nodes. Please write a program to help him.
The input contains two space-separated positive integers $n$ and $k$.
Output the number of nodes that can keep the $k$-th smallest element in a min-heap of $n$ nodes.
100 1
1
12 3
6
Please assume that all elements are distinct.
ICPC > Regionals > Asia Pacific > Taiwan > Taiwan Online Programming Contest > TOPC 2023 H번