F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

Easy $h$-index

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)
Total Submission(s): 6476    Accepted Submission(s): 1963


Problem Description
比赛题目:
http://acm.hdu.edu.cn/downloads/2018ccpc_hn.pdf

The $h$-index of an author is the largest $h$ where he has at least $h$ papers with citations not less than $h$.

Bobo has published many papers.
Given $a_0, a_1, a_2, \dots, a_{n}$ which means Bobo has published $a_i$ papers with citations exactly $i$, find the $h$-index of Bobo.

 

Input
The input consists of several test cases and is terminated by end-of-file.

The first line of each test case contains an integer $n$.
The second line contains $(n+1)$ integers $a_0, a_1, \dots, a_n$.
 

Output
For each test case, print an integer which denotes the result.

## Constraint

* $1 \leq n \leq 2 \cdot 10^5$
* $0 \leq a_i \leq 10^9$
* The sum of $n$ does not exceed $250,000$.
 

Sample Input
1 1 2 2 1 2 3 3 0 0 0 0
 

Sample Output
1 2 0
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 14:45:01, Gzip enabled