-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathA_Channel.cpp
More file actions
38 lines (33 loc) · 783 Bytes
/
Copy pathA_Channel.cpp
File metadata and controls
38 lines (33 loc) · 783 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
#include <bits/stdc++.h>
using namespace std;
int main() {
int t; cin >> t;
while (t--) {
int n, a, q; cin >> n >> a >> q;
string s; cin >> s;
int online = a;
int p = count(s.begin(), s.end(), '+');
if(n==a){
cout<<"YES"<<endl;
continue;
}
if (online + p < n) {
cout << "NO" << endl;
continue;
}
for (int i = 0; i < s.size(); i++) {
if (s[i] == '+') {
online++;
} else {
online--;
}
if (online == n) {
cout << "YES" << endl;
break;
}
}
if (online != n) {
cout << "MAYBE" << endl;
}
}
}