-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOFFSEND.cpp
More file actions
60 lines (47 loc) · 953 Bytes
/
OFFSEND.cpp
File metadata and controls
60 lines (47 loc) · 953 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include <stdio.h>
#include <utility>
#include <queue>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
int main()
{
int A, D;
while(true)
{
scanf("%d %d", &A, &D);
if(A == 0 && D == 0)
break;
vector<int> attacking_players;
vector<int> defending_players;
// scan attacking players
for(int k = 0; k < A; k++)
{
int g;
scanf("%d", &g);
attacking_players.push_back(g);
}
// scan defending players
for(int k = 0; k < D; k++)
{
int g;
scanf("%d", &g);
defending_players.push_back(g);
}
sort(attacking_players.begin(), attacking_players.end());
sort(defending_players.begin(), defending_players.end());
bool offside = false;
for(int k = 0; k < A; k++)
{
if(attacking_players[k] < defending_players[0] ||
attacking_players[k] < defending_players[1])
{
offside = true;
break;
}
}
printf("%c\r\n", offside ? 'Y' : 'N');
}
return 0;
}