https://i0.wp.com/eblogarithm.com/wp-content/uploads/2017/09/Codeforces-Round-436-Div-2-problem-A-Fair-Game-Solution-In-CC1.png?fit=640%2C360

Codeforces Round #436 (Div. 2), problem: (A) Fair Game Solution In C/C++

#include<cstdio>
#include<iostream>
using namespace std;

int n,cnt,ans,A,B;
int buck[500];

int main(){
scanf(“%d”,&n);

for(int i = 1;i <= n;i++){
cin >> cnt;
if(!buck[cnt]){
ans++;
if(A) B = cnt;
else A = cnt;
}
buck[cnt]++;
}

if(ans == 2 && buck[A] == buck[B]) printf(“YES\n%d %d”,A,B);
else printf(“NO”);

return 0;
}

(Visited 174 times, 1 visits today)



There are no comments

Add yours

Leave a Reply

%d bloggers like this: