Advertisement
_no0B

Untitled

Dec 6th, 2021
1,050
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.11 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. #define ll long long
  3. #define N ((int)6e4 + 5)
  4. #define MOD ((int)1e9 + 7)
  5. #define MAX ((int)1e9 + 7)
  6. #define MAXL ((ll)1e18 + 7)
  7. #define MAXP ((int)1e3 + 7)
  8. #define thr 1e-8
  9. #define pi acos(-1)  /// pi = acos ( -1 )
  10. #define fastio ios_base::sync_with_stdio(false),cin.tie(NULL)
  11. #define endl "\n"
  12.  
  13. using namespace std;
  14.  
  15. string dir;
  16.  
  17. int dxx[] = {1 , 0 , 0 , -1};
  18. int dyy[] = {0 , -1 , 1 , 0};
  19.  
  20. pair < int , int > des;
  21.  
  22. string dfs(int row , int col , int rem)
  23. {
  24.     if(rem == 0) return "";
  25.     for(int i = 0 ; i < 4 ; i++){
  26.         int x = row + dxx[i] , y = col + dyy[i];
  27.         if(IsValid(x, y) && dis[x][y] <= rem){
  28.             return dir[i] + dfs(x , y , rem-1);
  29.         }
  30.     }
  31.     return "IMPOSSIBLE";
  32. }
  33.  
  34. void bfs(int row , int col)
  35. {
  36.     /// bfs
  37. }
  38.  
  39. int main(){
  40.     dir = "DLRU";
  41.     for(int i = 0 ; i < n ; i++) cin>>str[i];
  42.     for(int i = 0 ; i < n ; i++){
  43.         for(int j = 0 ; j < m ; j++){
  44.             if(str[i][j] == 'X'){
  45.                 bfs(i,j);
  46.                 cout<<dfs(i,j,k)<<endl;
  47.                 return 0;
  48.             }
  49.         }
  50.     }
  51. }
  52.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement