破案问题
样例输入
3 2
166 50 30
178 60 23
132 40 15
167 50 30
178 60 23
样例输出
no
yes
#include<iostream>
#include<set>
using namespace std;
struct people{
int h;
int w;
int age;
people(int h1,int w1,int age1){
h=h1;
w=w1;
age=age1;
}
bool operator<(const people &rsh) const{
if(h!=rsh.h){
return h<rsh.h;
}
if(w!=rsh.w){
return w<rsh.w;
}
return age<rsh.age;
}
};
set<people> s;
int main()
{
int h,w,age,n,m;
cin>>n>>m;
for(int i=0;i<n;i++){
cin>>h>>w>>age;
s.insert(people(h,w,age));
}
for(int i=0;i<m;i++){
cin>>h>>w>>age;
if(s.count(people(h,w,age))){
cout<<"yes"<<endl;
}else{
cout<<"no"<<endl;
}
}
}