Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lab = raw_input()
- N = len (lab)
- i = 1
- lab = list (lab)
- while i < N :
- mas = raw_input()
- mas = list (mas)
- lab += mas
- i += 1
- mas = (0,) * N * N
- stack = []
- i = 0
- stack.append(i)
- mas = list(mas)
- while stack != [] :
- i = stack[0]
- stack.pop(0)
- mas[i] = 1
- if i + 1 == N * N - 1 :
- mas[i+1] = 1
- break
- else :
- if i + 1 < N * N - 1 and lab[i+1] == '.' and mas[i+1] == 0 :
- stack.append(i + 1)
- if i + N == N * N - 1 :
- mas[i+N] = 1
- break
- else :
- if i + N < N * N - 1 and lab[i+N] == '.' and mas[i+N] == 0 :
- stack.append(i + N)
- if mas[N * N - 1] == 0 :
- print'NO'
- else :
- print'YES'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement