Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <fstream>
- #include<queue>
- #include<cstring>
- using namespace std;
- ifstream fin("barlog.in");
- ofstream fout("barlog.out");
- struct poz{
- int x,y;
- };
- queue<poz>q;
- poz p1,p2;
- short int cer;
- char a[102][102][21];
- int n,m,lin,col,lee[101][101];
- char cuv[25];
- void bordare()
- {
- for(int i=0;i<=n+1;++i)
- lee[i][0] = lee[i][m+1] = -1;
- for(int j=0;j<=m+1;++j)
- lee[0][j] = lee[n+1][j] = -1;
- }
- int dx[]={1,0,-1,0};
- int dy[]={0,1,0,-1};
- bool subsir(char a[102][102][21], char cuv[25])
- {
- for(int i=0;i<strlen(a[i][j]);i++)
- if(strchr(a[i][j][]))
- }
- int main()
- {
- fin>>cer;
- fin>>n>>m;
- for(int i=1;i<=n;i++)
- {
- for(int j=1;j<=m;++j)
- fin>>a[i][j];
- }
- fin>>lin>>col;
- fin>>cuv;
- bordare();
- q.push({lin,col});
- while(!q.empty())
- {
- p1=q.front();
- q.pop();
- for(int i=0;i<4;i++)
- {
- p2.x=p1.x+dx[i];
- p2.y=p1.y+dy[i];
- if(subsir(a[p2.x][p2.y], cuv)) ///daca e subsir
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement