-
Notifications
You must be signed in to change notification settings - Fork 0
/
maxStreak.cpp
53 lines (49 loc) · 981 Bytes
/
maxStreak.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
// codechef contest 94 problem
// om and addy maintains streak , so find who has max streak
#include <bits/stdc++.h>
using namespace std;
int countMax(vector<int> &v) {
int maxEnd = 0,maxSoFar = 0;
for(int i = 0; i<v.size();i++) {
if(v[i] == 0) {
maxEnd = 0;
}
else {
++maxEnd;
}
maxSoFar = max(maxEnd,maxSoFar);
}
return maxSoFar;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int t,n,om,x,ad;
cin >> t;
while(t--) {
cin >> n;
vector<int> a,b;
a.reserve(n);
b.reserve(n);
for(int i = 0; i<n;i++) {
cin >> x;
a.emplace_back(x);
}
for(int i = 0; i<n;i++) {
cin >> x;
b.emplace_back(x);
}
om = countMax(a);
ad = countMax(b);
if(om > ad) {
cout << "OM\n";
}
else if(om < ad) {
cout << "ADDY\n";
}
else {
cout << "DRAW\n";
}
}
return 0;
}