forked from mpfeifer1/Kattis
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwolf.cpp
64 lines (52 loc) · 972 Bytes
/
wolf.cpp
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
60
61
62
63
64
#include <iostream>
#include <map>
using namespace std;
int main() {
int n;
cin >> n;
int theirs = 52 - n;
if(n > theirs) {
cout << "possible" << endl;
}
else if(n == theirs) {
map<char, int> maxfound;
map<char, int> count;
maxfound['C'] = 0;
maxfound['H'] = 0;
maxfound['D'] = 0;
maxfound['S'] = 0;
count['S'] = 0;
count['C'] = 0;
count['D'] = 0;
count['H'] = 0;
for(int i = 0; i < n; i++) {
char temp1;
int temp2;
cin >> temp2 >> temp1;
count[temp1]++;
maxfound[temp1] = max(maxfound[temp1], temp2);
}
bool possible = false;
if(maxfound['H'] > count['H']) {
possible = true;
}
if(maxfound['D'] > count['D']) {
possible = true;
}
if(maxfound['C'] > count['C']) {
possible = true;
}
if(maxfound['S'] > count['S']) {
possible = true;
}
if(possible) {
cout << "possible" << endl;
}
else {
cout << "impossible" << endl;
}
}
else {
cout << "impossible" << endl;
}
}