-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchannel2.cpp
46 lines (39 loc) · 897 Bytes
/
channel2.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
#include <iostream>
#include <string>
using namespace std;
int main() {
int t;
cin >> t;
while (t--) {
int n, a, q;
cin >> n >> a >> q;
string notifs;
cin >> notifs;
if (a == n) {
cout << "YES" << endl;
continue;
}
int unread = n - a;
for (int i = 0; i < q; i++) {
if (notifs[i] == '-') {
unread++;
} else {
if (unread > 0) {
unread--;
} else {
unread++;
}
}
}
if (unread == 0) {
cout << "YES" << endl;
}
else if (unread == (n-a)) {
cout << "MAYBE" << endl;
}
else {
cout << "NO" << endl;
}
}
return 0;
}