ABC 252, in process of making c, got idea but got sidetracked

This commit is contained in:
2022-05-29 23:42:21 +02:00
parent 841394f84c
commit 52cafc60f8
8 changed files with 238 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
#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;
}