-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchannel.cpp
More file actions
45 lines (43 loc) · 920 Bytes
/
channel.cpp
File metadata and controls
45 lines (43 loc) · 920 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
39
40
41
42
43
44
45
#include <bits/stdc++.h>
using namespace std;
#define ll long long int
#define pb push_back
#define pop pop_back
int main()
{
ll t;
cin>>t;
while(t--){
ll n,a,q;
cin>>n>>a>>q;
string s;
cin>>s;
if(n==a){
cout<<"YES"<<"\n";
}else{
ll se=a,ch=0,neg=0;
for(ll i=0;i<q;i++){
if(s[i]=='+'){
se+=1;
}else{
neg+=1;
}
if((se-neg)>=n){
cout<<"YES\n";
ch=1;
break;
}
}
if(ch==0){
if((se-neg)>=n){
cout<<"YES"<<"\n";
}else if((se>=n) && ((se-neg)<n)){
cout<<"MAYBE\n";
}else{
cout<<"NO\n";
}
}
}
}
return 0;
}