-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1410.cpp
More file actions
43 lines (31 loc) · 868 Bytes
/
1410.cpp
File metadata and controls
43 lines (31 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int A, D, at, de;
vector<int> defensores;
while(true) {
int menorAt = 0;
cin >> A >> D;
if (A == 0 && D == 0) break;
for(int i=0; i<A; i++) {
cin >> at;
if(i==0){
menorAt = at;
} else {
if(at < menorAt) menorAt = at;
}
}
for (int j=0; j<D; j++){
cin >> de;
defensores.push_back(de);
}
sort(defensores.begin(), defensores.end());
if (menorAt >= defensores[0] && menorAt >= defensores[1]) cout << "N" << endl;
else if (menorAt >= defensores[1]) cout << "N" << endl;
else cout << "Y" << endl;
defensores.clear();
}
return 0;
}