結果

問題 No.1954 CHECKER×CHECKER(2)
ユーザー 👑 H20H20
提出日時 2022-02-16 23:07:18
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,138 bytes
コンパイル時間 286 ms
コンパイル使用メモリ 87,184 KB
実行使用メモリ 84,756 KB
最終ジャッジ日時 2023-09-10 16:32:01
合計ジャッジ時間 4,486 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
76,208 KB
testcase_01 AC 85 ms
71,580 KB
testcase_02 AC 85 ms
71,512 KB
testcase_03 AC 87 ms
71,556 KB
testcase_04 AC 85 ms
71,576 KB
testcase_05 AC 84 ms
71,676 KB
testcase_06 AC 84 ms
71,616 KB
testcase_07 AC 85 ms
71,796 KB
testcase_08 AC 85 ms
71,796 KB
testcase_09 AC 100 ms
77,208 KB
testcase_10 AC 94 ms
76,416 KB
testcase_11 AC 94 ms
76,404 KB
testcase_12 AC 86 ms
71,760 KB
testcase_13 AC 107 ms
78,540 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import copy
H,W = map(int, input().split())
MAP = [list(input()) for _ in range(H)]
M = int(input())
TN = [list(map(int, input().split())) for _ in range(M)]

for i in range(H):
    for j in range(W):
        if (i+j)%2==1:
            if MAP[i][j]=='.':
                MAP[i][j]='#'
            else:
                MAP[i][j]='.'

for i in range(2 ** M):
    TNN = []
    for j in range(M):  
        if ((i >> j) & 1):
            TNN.append(TN[j])
    CMAP = copy.deepcopy(MAP)
    for t,n in TNN:
        if t==1:
            for i in range(n):
                for j in range(W):
                    if CMAP[i][j]=='#':
                        CMAP[i][j]='.'
                    else:
                        CMAP[i][j]='#'
        else:
            for i in range(H):
                for j in range(n):
                    if CMAP[i][j]=='#':
                        CMAP[i][j]='.'
                    else:
                        CMAP[i][j]='#'
    f = True
    for i in range(H):
        for j in range(W):
            if CMAP[0][0]!=CMAP[i][j]:
                f=False
    if f:
        print('Yes')
        exit()

print('No')
0