44 lines
710 B
C++
44 lines
710 B
C++
#include <bits/stdc++.h>
|
|
|
|
using namespace std;
|
|
|
|
|
|
int main(){
|
|
ios::sync_with_stdio(0);
|
|
cin.tie(0);
|
|
|
|
int n, k;
|
|
cin >> n >> k;
|
|
|
|
set<int> tasty_foods;
|
|
int tastiest = 0;
|
|
|
|
for(int i = 0; i < n; ++i){
|
|
int a;
|
|
cin >> a;
|
|
|
|
if(a > tastiest){
|
|
tasty_foods.clear();
|
|
tastiest = a;
|
|
tasty_foods.insert(i+1);
|
|
} else if(a == tastiest){
|
|
tasty_foods.insert(i+1);
|
|
}
|
|
}
|
|
|
|
for(int i = 0; i < k; ++i){
|
|
int b;
|
|
cin >> b;
|
|
|
|
if(tasty_foods.count(b)){
|
|
cout << "Yes" << endl;
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
cout << "No" << endl;
|
|
|
|
cout << flush;
|
|
|
|
return 0;
|
|
} |