阅读背景:

Codeforces Round #436 (Div. 2)_傻傻分不清、

来源:互联网 

A

判断只有两种数字并且他们的数量是相等的

By _sasuke, contest: Codeforces Round #436 (Div. 2), problem: (A) Fair Game, Accepted, #

#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <sstream>
#include <string>
#include <vector>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <utility>
#include <bitset>

using namespace std;
#define LL long long
#define pb push_back
#define mk make_pair
#define pill pair<int, int>
#define mst(a, b)	memset(a, b, sizeof a)
#define REP(i, x, n)	for(int i = x; i <= n; ++i)
const int MOD = 1e9 + 7;
const int qq = 1e5 + 10;
const LL INF = 1e9 + 10;
map<int, int>  mp;

int main(){
	int n;	scanf("%d", &n);
	for(int i = 0; i < n; ++i) {
		int x;	scanf("%d", &x);
		mp[x]++;
	}
	map<int, int>::iterator it1, it2;
	it1 = mp.begin();
	it2 = mp.begin();
	it2++;
	if(mp.size() == 2) {
		if(it1->second == it2->second) {
			puts("YES");
			printf("%d %d\n", it1->first, it2->first);
		} else {
			puts("NO");
		}
	} else {
		puts("NO");
	}
	return 0;
}By _sasuke, contes



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: