fork download
  1. #pragma GCC optimize("Ofast")
  2. #pragma GCC optimize("unroll-loops")
  3. #pragma GCC optimize("inline")
  4. #include<bits/stdc++.h>
  5. using namespace std;
  6. #define main dummy_main
  7. int main(){
  8. return 0;
  9. }
  10. #undef main
  11. class Solution{
  12. public:
  13. vector<int> executeInstructions(int n, vector<int>& startPos, string s){
  14. int m;
  15. vector<int> res;
  16. int tmp;
  17. int x;
  18. int y;
  19. for(m=(0);m<(s.size());m++){
  20. int i;
  21. tmp = 0;
  22. auto Q5VJL1cS = ((startPos[0]));
  23. auto e98WHCEY = (( startPos[1]));
  24. x=Q5VJL1cS;
  25. y=e98WHCEY;
  26. for(i=(m);i<(s.size());i++){
  27. if(s[i]=='U'){
  28. x--;
  29. }
  30. if(s[i]=='D'){
  31. x++;
  32. }
  33. if(s[i]=='L'){
  34. y--;
  35. }
  36. if(s[i]=='R'){
  37. y++;
  38. }
  39. if(x < 0 || y < 0 || x >= n || y >= n){
  40. break;
  41. }
  42. tmp++;
  43. }
  44. res.push_back(tmp);
  45. }
  46. return res;
  47. }
  48. }
  49. ;
  50. // cLay version 20211231-1
  51.  
  52. // --- original code ---
  53. // #define main dummy_main
  54. // {}
  55. // #undef main
  56. //
  57. // class Solution {
  58. // public:
  59. // VI executeInstructions(int n, VI& startPos, string s) {
  60. // VI res;
  61. // int tmp, x, y;
  62. // rep(m,s.size()){
  63. // tmp = 0;
  64. // (x, y) = (startPos[0], startPos[1]);
  65. // rep(i,m,s.size()){
  66. // if(s[i]=='U') x--;
  67. // if(s[i]=='D') x++;
  68. // if(s[i]=='L') y--;
  69. // if(s[i]=='R') y++;
  70. // if(x < 0 || y < 0 || x >= n || y >= n) break;
  71. // tmp++;
  72. // }
  73. // res.push_back(tmp);
  74. // }
  75. // return res;
  76. // }
  77. // };
  78.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/8/../../../x86_64-linux-gnu/Scrt1.o: in function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
stdout
Standard output is empty