ABC 252, in process of making c, got idea but got sidetracked
This commit is contained in:
44
atcoder/beginner_contests/252/b.cpp
Normal file
44
atcoder/beginner_contests/252/b.cpp
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user