Codeforces Round #383 (Div. 2), problem: (B) Arpa’s obvious problem and Mehrdad’s terrible solution , Solution in C/C++

#include<stdio.h>
int v[1500010];
int main(){
	int i,l,n,x;
	long long int r;
	scanf("%d%d",&n,&x);
	for(i=0;i<n;i++)
	{
		scanf("%d",&l);
		r=r+v[l^x];
		v[l]++;
	}
	printf("%I64d",r);
	return 0;
}
#include<stdio.h>
int v[1500010];
int main(){
	int i,l,n,x;
	long long int r;
	scanf("%d%d",&n,&x);
	for(i=0;i<n;i++)
	{
		scanf("%d",&l);
		r=r+v[l^x];
		v[l]++;
	}
	printf("%I64d",r);
	return 0;
}

More from author

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Related posts

Advertismentspot_img

Latest posts

Famed mountaineer Nirmal Purja, 43, among 10 climbers killed after avalanche in Pakistan

Tragedy in the Karakoram: Nirmal Purja Among 10 Lost in Avalanche In a devastating turn of events for the global mountaineering community, renowned high-altitude climber...

How Under Desk Storage Is Quietly Changing the Game

📢 As an Amazon Associate, I earn from qualifying purchases.There comes a point when you realise that tolerating a frustrating situation is costing you...

Has a woman ever mated with an ape?

Throughout history, urban legends, mythology, and speculative fiction have frequently explored the boundaries between humans and animals. One of the most persistent and sensationalized...

Want to stay up to date with the latest news?

We would love to hear from you! Please fill in your details and we will stay in touch. It's that simple!