Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define _test int _TEST; cin>>_TEST; while(_TEST--)
- int main()
- {
- _test
- {
- int n, m, q;
- cin>>n>>m>>q;
- string s;
- cin>>s;
- int mmax = m;
- int tot = m;
- for(auto e: s)
- {
- m += (e == '+');
- m -= (e == '-');
- mmax = max(mmax, m);
- tot += (e == '+');
- }
- if(mmax == n)
- cout<<"YES\n";
- else if(tot >= n)
- cout<<"MAYBE\n";
- else
- cout<<"NO\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement