-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathArmy.cpp
39 lines (33 loc) · 799 Bytes
/
Army.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
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
long long T;
cin >> T;
while(T--) {
long long nA, nB;
cin >> nA >> nB;
vector<long long> a(nA), b(nB);
for(long long i = 0; i < nA; i++) cin >> a[i];
for(long long i = 0; i < nB; i++) cin >> b[i];
std::sort(a.begin(), a.end());
std::sort(b.begin(), b.end());
long long aIndex = 0, bIndex = 0;
while(aIndex < a.size() && bIndex < b.size()) {
if(a[aIndex] > b[bIndex])
bIndex++;
else if(a[aIndex] < b[bIndex])
aIndex++;
else
bIndex++;
}
if(bIndex == b.size())
cout << "Godzilla\n";
else if(aIndex == a.size())
cout << "MechaGodzilla\n";
else
cout << "uncertain\n";
}
return 0;
}