【BZOJ 1982】[Spoj 2021] Moving Pebbles

题目传送门:http://www.lydsy.com/JudgeOnline/problem.php?id=1982

同POJ_1740

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

const int MAXN = 100000+9;

int arr[MAXN],n;

inline int read(){
	char c=getchar(); int ret=0;
	while (c<'0'||c>'9') c=getchar();
	while (c<='9'&&c>='0') ret=ret*10+c-'0',c=getchar();
	return ret;
}

int main(){
	while (~scanf("%d",&n)) {
		for (int i=1;i<=n;i++) arr[i] = read();
		sort(arr+1,arr+1+n);
		if (n%2) {cout<<"first player"<<endl; continue;} int tag = 1;
		for (int i=1;i<=n;i+=2) if (arr[i] != arr[i+1]) {cout<<"first player"<<endl; tag = 0; break;}
		if (tag) cout<<"second player"<<endl;
	}
	return 0;
} 

2 thoughts to “【BZOJ 1982】[Spoj 2021] Moving Pebbles”

  1. Great beat ! I wish to apprentice while you amend your website, how could i subscribe for a blog website? The account helped me a acceptable deal. I had been tiny bit acquainted of this your broadcast provided bright clear concept

  2. I?¦m no longer sure where you are getting your info, but great topic. I must spend a while finding out much more or working out more. Thank you for great information I used to be in search of this info for my mission.

Leave a Reply

Your email address will not be published. Required fields are marked *