1. 程式人生 > >Educational Codeforces Round 51 (Rated for Div. 2)(CF 2018.09.22)

Educational Codeforces Round 51 (Rated for Div. 2)(CF 2018.09.22)

#include<iostream>
#include<cstdio>
using namespace std;
long long l,r;
int main()
{
	scanf("%I64d  %I64d ",&l,&r);
	printf("YES\n");
	for(long long j=1,i=l;j<=(r-l+1)/2,i<r;j++,i=i+2)
	{
		printf("%I64d %I64d \n",i,i+1);
	}
	return 0;
}
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
int a[106];
int cnt[106];
int main()
{
	int n;
	int flag=0;
	int num=0;
	string ss="";
	scanf("%d",&n);
	memset(cnt,0,sizeof(cnt));
	for(int i=0;i<n;i++)
	{
		scanf("%d",&a[i]);
		cnt[a[i]]++;	
	}
	for(int i=0;i<n;i++)
	{
		if(cnt[a[i]]==1)
		   num++;
	}
	if(num%2==0)
	{
		ss="";
		printf("YES\n");
		for(int i=0;i<num/2;i++)
		    ss=ss+"A";
		for(int i=0;i<n-num/2;i++)
		    ss=ss+"B";
		cout<<ss<<endl;
	}
	else
	{
		ss="";
		for(int i=0;i<n;i++)
		{
			if(cnt[a[i]]>=3)
			{
				flag=1;
				break;
			}
		}
		if(flag==0) printf("NO\n");
		else
		{
			printf("YES\n");
			for(int i=0;i<num/2;i++)
		      ss=ss+"A";
		    ss=ss+"A";
		    for(int i=0;i<n-num/2-1;i++)
		       ss=ss+"B";
		    cout<<ss<<endl;
		}
	}
	return 0;
}