# whust 2016 warm up ||codeforces 682 B. Alyona and Mex (离散化)

Posted by 111qqz on Monday, July 18, 2016

## TOC

cf682B题目链接

``````/* ***********************************************
Author :111qqz
Created Time :2016年07月18日 星期一 12时43分41秒
File Name :code/2016whus/B.cpp
************************************************ */

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <string>
#include <cmath>
#include <cstdlib>
#include <ctime>
#define fst first
#define sec second
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define ms(a,x) memset(a,x,sizeof(a))
typedef long long LL;
#define pi pair < int ,int >
#define MP make_pair

using namespace std;
const double eps = 1E-8;
const int dx4[4]={1,0,0,-1};
const int dy4[4]={0,-1,1,0};
const int inf = 0x3f3f3f3f;
const int N=1E5+7;
int b[N];
int a[N];
int n;
int main()
{
#ifndef  ONLINE_JUDGE
freopen("code/in.txt","r",stdin);
#endif

cin>>n;
ms(a,0);
for ( int i = 1 ; i <= n ; i++) scanf("%d",&a[i]);
sort(a+1,a+n+1);
int cnt = 0 ;
for ( int i = 1 ; i <= n ; i++)
{
if (cnt+1<=a[i]) cnt++;
b[i] = cnt;
}

//	for ( int i = 1 ; i <= n ; i++) cout<<b[i]<<endl;
cout<<b[n]+1<<endl;
#ifndef ONLINE_JUDGE
fclose(stdin);
#endif
return 0;
}
``````

「真诚赞赏，手留余香」