Saleh127

codeforces 1200A.cpp

May 25th, 2020
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define test int t; cin>>t; while (t--)
  4. #define ll long long int
  5. #define sc(a) scanf("%lld",&a)
  6. #define sc2(a,b) scanf("%lld %lld",&a,&b)
  7. #define pf(a) printf("%lld",a)
  8. #define loop1(i,a,c) for(i=a;i<=c;i++)
  9. #define loop(i,c) for(i=0;i<c;i++)
  10. int main()
  11. {
  12. string a,c="0000000000";
  13. ll d,e,f,i,j,k,l;
  14. cin>>d;
  15. cin>>a;
  16. l=c.size();
  17. for(i=0; i<d; i++)
  18. {
  19. if(a[i]>='0' && a[i]<='9')
  20. {
  21. e=a[i]-'0';
  22. c[e]='0';
  23. }
  24. if(a[i]=='L')
  25. {
  26. for(j=0; j<l; j++)
  27. {
  28. if(c[j]=='0')
  29. {
  30. c[j]='1';
  31. break;
  32. }
  33. }
  34. }
  35. if(a[i]=='R')
  36. {
  37. for(k=l-1; k>=0; k--)
  38. {
  39. if(c[k]=='0')
  40. {
  41. c[k]='1';
  42. break;
  43. }
  44. }
  45. }
  46. }
  47. cout<<c<<endl;
  48. return 0;
  49. }
Advertisement
Add Comment
Please, Sign In to add comment