I have been at this for hours, and I can't find out why it's giving me WA!
I checked with other accepted answers and the basic logic is the same.
What's could the problem be?
```python3
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sat Feb 15 09:34:13 2020
@author: shreya
"""
T = int(input())
for t in range(1, T+1):
R, C, K = map(int, input().split())
openDoors = []
if K == (R*C)-1:
print("Case #{}: IMPOSSIBLE".format(t))
continue
if C == 1:
openDoors = ['N']*K + ['S'] + ['N']*(R-K-1)
print("Case #{}: POSSIBLE\n{}".format(t, '\n'.join(openDoors)))
continue
openRow = ['N']*C
closedRow = ['E'] + ['W']*(C-1)
openDoors = [openRow]*(K//C)
if not K%C: # divisible
openDoors.extend([closedRow]*(R-(K//C)))
else:
row = ['N']*(K%C) + ['E'] + ['W']*(C-(K%C)-1)
if C-(K%C)-1 == 0:
row[-1] = 'S'
openDoors.append(row)
openDoors.extend([closedRow]*(R-(K//C)-1))
for i in range(0, R):
openDoors[i] = ''.join(openDoors[i])
print("Case #{}: POSSIBLE\n{}".format(t, '\n'.join(openDoors)))
```
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/google-code/736af48e-000d-456f-94c4-24e596232695%40googlegroups.com.