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;
}

Advertisement

spot_img

How Viral Kitchen Gadgets...

📢 As an Amazon Associate, I earn from qualifying...

How can you tell...

Tears are among humanity's most potent emotional signals, capable...

Is Viral Kitchen Gadgets...

📢 As an Amazon Associate, I earn from qualifying...

Power bank triggers fire...

A routine afternoon journey turned into a moment of...

The Real Truth About...

📢 As an Amazon Associate, I earn from qualifying...

Can a man kill...

Pop culture and action cinema often feed the dramatic...

How Viral Kitchen Gadgets Is Quietly Changing the Game

📢 As an Amazon Associate, I earn from qualifying purchases.If you had told me six months ago that a single purchase would change how...

How can you tell fake crying?

Tears are among humanity's most potent emotional signals, capable of evoking immediate empathy and altering social dynamics. However, not all tears flow from genuine...

Is Viral Kitchen Gadgets Worth Your Money Here Is Our Full Review

📢 As an Amazon Associate, I earn from qualifying purchases.If you had told me six months ago that a single purchase would change how...

Power bank triggers fire in Mumbai local train, no injury reported

A routine afternoon journey turned into a moment of acute terror for commuters on Central Railway after a portable power bank abruptly caught fire...

The Real Truth About Viral Kitchen Gadgets Before You Buy

📢 As an Amazon Associate, I earn from qualifying purchases.Most products in this category disappoint within weeks. Cheap materials, vague instructions, and results that...

Can a man kill a bear with his hands?

Pop culture and action cinema often feed the dramatic fantasy of human triumph over apex predators, sparking a persistent debate: can a man kill...

7 Reasons This Viral Kitchen Gadgets Is Worth Every Single Penny

📢 As an Amazon Associate, I earn from qualifying purchases.Most products in this category disappoint within weeks. Cheap materials, vague instructions, and results that...

Can you have just one ferret?

Welcoming a pet ferret into your home is an exciting decision, but it frequently prompts an essential question for prospective owners: can you have...

We Tested Viral Kitchen Gadgets Here Is What You Must Know

📢 As an Amazon Associate, I earn from qualifying purchases.If you had told me six months ago that a single purchase would change how...