C. Keshi Is Throwing a Party
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output
Keshi is throwing a party and he wants everybody in the party to be happy.
He has n
friends. His i-th friend has i
dollars.
If you invite the i
-th friend to the party, he will be happy only if at most ai people in the party are strictly richer than him and at most bi
people are strictly poorer than him.
Keshi wants to invite as many people as possible. Find the maximum number of people he can invite to the party so that every invited person would be happy.
Input
The first line contains a single integer t
(1≤t≤104)
— the number of test cases. The description of the test cases follows.
The first line of each test case contains a single integer n
(1≤n≤2⋅105)
— the number of Keshi’s friends.