//??¶??´???4s   ?????´???256MB
//?¢????:??¨????£?????????±????????????????????????,??????n?????????,??¨?????¨??±??????di
//????????????????????????,???????¬??????°?????????????????????1?????????,??£????°±?????????
//???????????\???????????????,???????????±??????0
//??????:??´??\?¨????????????????,??°????????????????????????,??°??????????????????????????? 
//????????±?????????,??????????????????????????°???????????????,???????§???¨?????\?°??????¬
//?§???¨??????????£???????,??¶????°???¶????????????,??´??°?????±???
//??????????????????,?????\?°????????????§??±???,???????????°??????,?????\?????°??????
//??????????????±???????????????????????????,??£?°±?°????????????????????§???¨
//??????????????????????????????????????\????????????,????????????????????????????????????
//??????????????????,??£?°±??§????°???????????§???¨ 
//???????????????????¢???????,??????????????±?¢?????????? 
//????????????????¢?????????????,?°±??´??\No,????????¨??????????????????,??£????????????
//?????¶????????????????????±????????????,??????????????±??????????????????????????? 
//???????¢?????????°???,????????????????????´?????°?????°??????,?????\?????????????????????
//????????´??\???????°±?????\???(??¨??????????????????????????????)??????????????´??°??????
//?????±?????±??? 
#include<cstdio>
#include<algorithm>
using namespace std;
int d[1000005];
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	int n;
	scanf("%d",&n);
	int top=0,down=0;
	while(n--){
		int x;
		scanf("%d",&x);
		if(d[0]||x<top){printf("No\n");continue;}		
		if(x==top&&top!=down){printf("No\n");continue;}
		if(x>=1000000){printf("Yes\n");down=max(down,x);continue;}
		d[x]++;down=max(down,x);
		while(d[x]>=2){
			d[x-1]++;
			d[x]=0;
			if(x==down)down--;
			x--;
		}
		for(int i=top+1;d[i]==1;i++)
			top=i;
		printf("Yes\n");
	}
	return 0;
} 
### Prompt

Please provide a Cpp coded solution to the problem described below:

Example

Input

6
2
3
1
1
4
2


Output

Yes
Yes
Yes
No
Yes
No

### Response

```cpp
//??¶??´???4s   ?????´???256MB
//?¢????:??¨????£?????????±????????????????????????,??????n?????????,??¨?????¨??±??????di
//????????????????????????,???????¬??????°?????????????????????1?????????,??£????°±?????????
//???????????\???????????????,???????????±??????0
//??????:??´??\?¨????????????????,??°????????????????????????,??°??????????????????????????? 
//????????±?????????,??????????????????????????°???????????????,???????§???¨?????\?°??????¬
//?§???¨??????????£???????,??¶????°???¶????????????,??´??°?????±???
//??????????????????,?????\?°????????????§??±???,???????????°??????,?????\?????°??????
//??????????????±???????????????????????????,??£?°±?°????????????????????§???¨
//??????????????????????????????????????\????????????,????????????????????????????????????
//??????????????????,??£?°±??§????°???????????§???¨ 
//???????????????????¢???????,??????????????±?¢?????????? 
//????????????????¢?????????????,?°±??´??\No,????????¨??????????????????,??£????????????
//?????¶????????????????????±????????????,??????????????±??????????????????????????? 
//???????¢?????????°???,????????????????????´?????°?????°??????,?????\?????????????????????
//????????´??\???????°±?????\???(??¨??????????????????????????????)??????????????´??°??????
//?????±?????±??? 
#include<cstdio>
#include<algorithm>
using namespace std;
int d[1000005];
int main(){
	//freopen("a.in","r",stdin);
	//freopen("a.out","w",stdout);
	int n;
	scanf("%d",&n);
	int top=0,down=0;
	while(n--){
		int x;
		scanf("%d",&x);
		if(d[0]||x<top){printf("No\n");continue;}		
		if(x==top&&top!=down){printf("No\n");continue;}
		if(x>=1000000){printf("Yes\n");down=max(down,x);continue;}
		d[x]++;down=max(down,x);
		while(d[x]>=2){
			d[x-1]++;
			d[x]=0;
			if(x==down)down--;
			x--;
		}
		for(int i=top+1;d[i]==1;i++)
			top=i;
		printf("Yes\n");
	}
	return 0;
} 
```