結果
問題 |
No.179 塗り分け
|
ユーザー |
![]() |
提出日時 | 2015-10-21 16:55:59 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 754 bytes |
コンパイル時間 | 138 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-10-02 14:46:05 |
合計ジャッジ時間 | 2,936 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | RE * 6 |
other | RE * 40 |
ソースコード
import copy H,W=int(input()) S=[] for i in range(H): S.append(input()) cnt_black = sum(S[i].count('#') for i in range(H)) if cnt_black %2 == 1: print('NO') exit() for h in range(H): for w in range(W): if h==0 and w==0: continue s = copy.deepcopy(S) for i in range(H): for j in range(W): cnt = 0 if s[i][j] == '#': if 0 <= i+h < H and 0 <= j+w <W and s[i+h][j+w] == '#': s[i][j] = 'r' s[i+h][j+w] = 'b' cnt += 2 else: break if cnt == cnt_black: print('YES') exit() print('NO')