PHƯỚC HƯNG OJ · THỬ THÁCH THUẬT TOÁN
#BS0000082. Chỉ số H trên dãy đã sắp xếp (H-Index II)
HỌC THEO LỘ TRÌNH
1 lộ trìnhBài tập thuộc lộ trình
Mục lục đề ⌄
Đang đọc
Chỉ số H trên dãy đã sắp xếp (H-Index II)
H-Index II
Source: LeetCode
Version: Phuoc Hung OJ Extended
Problem Statement
A researcher has papers with non-decreasing citation counts . Find the greatest nonnegative integer such that at least papers have at least citations each.
Input
The first line contains , and the next line contains the non-decreasing citation counts.
Output
Print the greatest valid .
Subtasks
- Subtask 1 (20 points): ; ; citation counts are non-decreasing.
- Subtask 2 (30 points): ; ; citation counts are non-decreasing.
- Subtask 3 (50 points): ; ; citation counts are non-decreasing.
Examples
Input
5
0 1 3 5 6
Output
3
Explanation
Three papers have citation counts , hence works. Only two papers have at least four citations, so is impossible. Output 3.