Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. #include <fstream>
  2. #include<queue>
  3. #include<cstring>
  4.  
  5. using namespace std;
  6.  
  7. ifstream fin("barlog.in");
  8. ofstream fout("barlog.out");
  9.  
  10. struct poz{
  11. int x,y;
  12. };
  13.  
  14. queue<poz>q;
  15. poz p1,p2;
  16.  
  17. short int cer;
  18. char a[102][102][21];
  19. int n,m,lin,col,lee[101][101];
  20. char cuv[25];
  21.  
  22. void bordare()
  23. {
  24. for(int i=0;i<=n+1;++i)
  25. lee[i][0] = lee[i][m+1] = -1;
  26. for(int j=0;j<=m+1;++j)
  27. lee[0][j] = lee[n+1][j] = -1;
  28. }
  29.  
  30. int dx[]={1,0,-1,0};
  31. int dy[]={0,1,0,-1};
  32.  
  33. bool subsir(char a[102][102][21], char cuv[25])
  34. {
  35. for(int i=0;i<strlen(a[i][j]);i++)
  36. if(strchr(a[i][j][]))
  37.  
  38. }
  39. int main()
  40. {
  41. fin>>cer;
  42. fin>>n>>m;
  43.  
  44. for(int i=1;i<=n;i++)
  45. {
  46. for(int j=1;j<=m;++j)
  47. fin>>a[i][j];
  48.  
  49.  
  50. }
  51.  
  52. fin>>lin>>col;
  53. fin>>cuv;
  54.  
  55. bordare();
  56.  
  57. q.push({lin,col});
  58.  
  59. while(!q.empty())
  60. {
  61. p1=q.front();
  62. q.pop();
  63. for(int i=0;i<4;i++)
  64. {
  65. p2.x=p1.x+dx[i];
  66. p2.y=p1.y+dy[i];
  67.  
  68. if(subsir(a[p2.x][p2.y], cuv)) ///daca e subsir
  69.  
  70. }
  71.  
  72.  
  73. }
  74.  
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement