-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCodeForces-1358B.cpp
62 lines (48 loc) · 1.32 KB
/
CodeForces-1358B.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
//
// Created by abdob on 10/29/2022.
//
#include<bits/stdc++.h>
#include<stdio.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
#define ll long long
#define scl(n) scanf("%lld",&n)
#define scll(n, m) scanf("%lld%lld",&n, &m)
#define scc(c) scanf("%c",&c)
#define fr(i,n) for (ll i=0;i<n;i++)
#define fr1(i,n) for(ll i=1;i<=n;i++)
#define pfl(x) printf("%lld\n",x)
#define pb push_back
#define debug cout<<"I am here"<<endl;
#define pno cout<<"NO"<<endl
#define pys cout<<"YES"<<endl
#define tcas(i,t) for(ll i=1;i<=t;i++)
int main()
{
ll t;
scl(t);
while(t--)
{
ll m,n,b,c,d,i,j,k,x,y,z,l,q,r;
string s,s1, s2, s3, s4;
ll cnt=0,cn=0,ans=1,sum=0 ;
scl(n);
ll a[n];
fr(i, n)scl(a[i]);
sort(a, a+n);
fr(i, n)
{
if(a[i] <= ans )ans++;
else
{
cnt++;
ll tmp=ans+cnt;
//cout<<"tmp "<<tmp<<" ";
if(a[i]<=tmp-1 )ans=tmp, cnt=0;
}
}
pfl(ans);
}
return 0;
}