mirror of
https://github.com/Kiritow/OJ-Problems-Source.git
synced 2024-03-22 13:11:29 +08:00
Create 1595_Richr_Wong.cpp
From http://blog.csdn.net/richr_wong/article/details/50193321
This commit is contained in:
parent
4598853d99
commit
07a2ad9470
51
UVA/1595_Richr_Wong.cpp
Normal file
51
UVA/1595_Richr_Wong.cpp
Normal file
|
@ -0,0 +1,51 @@
|
|||
#include <iostream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <set>
|
||||
#include <map>
|
||||
#include <sstream>
|
||||
#include <fstream>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
typedef pair<int,int> point;
|
||||
|
||||
int main()
|
||||
{
|
||||
int T;
|
||||
cin>>T;
|
||||
for(int i=0;i<T;i++)
|
||||
{
|
||||
int n;
|
||||
set<point> data;
|
||||
cin>>n;
|
||||
int sum = 0;
|
||||
for(int j=0;j<n;j++)
|
||||
{
|
||||
int x,y;
|
||||
cin>>x>>y;
|
||||
sum+=x;
|
||||
data.insert(point(x*n,y));
|
||||
}
|
||||
bool flag = true;
|
||||
for(set<point>::iterator i=data.begin();i!=data.end();i++)
|
||||
{
|
||||
point p = *i;
|
||||
if(data.find(point(2*sum-p.first,p.second))==data.end())
|
||||
{
|
||||
flag = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(flag==true)
|
||||
{
|
||||
cout<<"YES"<<endl;
|
||||
}
|
||||
else
|
||||
{
|
||||
cout<<"NO"<<endl;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user