fork download
  1. #include "bits/stdc++.h"
  2. using namespace std;
  3. int main(){
  4. int nn;
  5. cin >> nn;
  6. while(nn--){
  7. int n,m;
  8. cin >> n >> m;
  9. string com;
  10. cin >> com;
  11. int x = 0, y = 0;
  12. bool falg = 0;
  13. rep(i, 0, sz(com)){
  14. if(com[i] == 'L')
  15. x--;
  16. if(com[i] == 'R')
  17. x++;
  18. if(com[i] == 'U')
  19. y++;
  20. if(com[i] == 'D')
  21. y--;
  22.  
  23. if(abs(x) > m-1 || abs(y) > n-1){
  24. cout << "unsafe" << endl;
  25. falg = 1;
  26. break;
  27. }
  28. }
  29. if(!falg)
  30. cout << "safe" << endl;
  31. }
  32. return 0;
  33. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp: In function ‘int main()’:
prog.cpp:13:7: error: ‘i’ was not declared in this scope
   rep(i, 0, sz(com)){
       ^
prog.cpp:13:19: error: ‘sz’ was not declared in this scope
   rep(i, 0, sz(com)){
                   ^
prog.cpp:13:20: error: ‘rep’ was not declared in this scope
   rep(i, 0, sz(com)){
                    ^
stdout
Standard output is empty