Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through these links, eBlogarithm may earn a commission at no extra cost to you. Prices and availability are subject to change.
#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;
}
📦 Looking for Codeforces Round 436 Div Problem Fair? Check the best deals on Amazon.
🛒 Shop Codeforces Round 436 Div Problem Fair on Amazon
As an Amazon Associate, eBlogarithm earns from qualifying purchases. Prices and availability are subject to change.
Affiliate Disclosure: This post contains Amazon affiliate links. If you purchase through these links, eBlogarithm may earn a commission at no extra cost to you. Prices and availability are subject to change.
#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;
}
📦 Looking for Codeforces Round 436 Div Problem Fair? Check the best deals on Amazon.
🛒 Shop Codeforces Round 436 Div Problem Fair on Amazon
As an Amazon Associate, eBlogarithm earns from qualifying purchases. Prices and availability are subject to change.