Codeforces Round #699 (Div. 2) Editorial

Revision en1, by Kilani, 2021-02-05 19:34:02
Tutorial is loading...

Spoiler

include <bits/stdc++.h>

using namespace std;

int main(){ int t;cin>>t; while(t--){ int x,y;cin>>x>>y; string s;cin>>s; int u=0,d=0,l=0,r=0; for(int i=0;i<s.length();i++){ if(s[i]=='U')u++; else if(s[i]=='R')r++; else if(s[i]=='D')d++; else l++; } if(x > 0 && r >= x )x = 0; if(x < 0 && l >= -x )x = 0; if(y > 0 && u >= y )y = 0; if(y < 0 && d >= -y )y = 0; cout<<((!x && !y)?"YES":"NO")<<endl; } } ~~~~~

Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...
Tutorial is loading...

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English Kilani 2021-02-05 19:56:06 53 Tiny change: 'eration: [submission:Warawreh]' -> 'eration: [user:Warawreh]'
en2 English Kilani 2021-02-05 19:45:59 7554 Tiny change: 'n<spoiler value="code">\' -> 'n<spoiler title="code">\' (published)
en1 English Kilani 2021-02-05 19:34:02 760 Initial revision (saved to drafts)