結果

問題 No.1954 CHECKER×CHECKER(2)
ユーザー titiatitia
提出日時 2022-05-22 03:42:55
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 1,028 bytes
コンパイル時間 216 ms
コンパイル使用メモリ 12,016 KB
実行使用メモリ 10,456 KB
最終ジャッジ日時 2023-10-20 16:48:54
合計ジャッジ時間 2,540 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,220 KB
testcase_01 AC 30 ms
10,220 KB
testcase_02 AC 29 ms
10,220 KB
testcase_03 AC 29 ms
10,220 KB
testcase_04 AC 29 ms
10,220 KB
testcase_05 AC 29 ms
10,220 KB
testcase_06 AC 29 ms
10,220 KB
testcase_07 AC 29 ms
10,220 KB
testcase_08 AC 29 ms
10,220 KB
testcase_09 AC 30 ms
10,220 KB
testcase_10 AC 30 ms
10,220 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 30 ms
10,224 KB
testcase_16 AC 30 ms
10,224 KB
testcase_17 AC 30 ms
10,224 KB
testcase_18 AC 30 ms
10,224 KB
testcase_19 AC 30 ms
10,244 KB
testcase_20 AC 30 ms
10,244 KB
testcase_21 AC 58 ms
10,456 KB
testcase_22 AC 61 ms
10,456 KB
testcase_23 AC 31 ms
10,240 KB
testcase_24 AC 57 ms
10,456 KB
testcase_25 AC 59 ms
10,456 KB
testcase_26 WA -
testcase_27 AC 61 ms
10,456 KB
testcase_28 AC 58 ms
10,456 KB
testcase_29 AC 29 ms
10,220 KB
testcase_30 WA -
testcase_31 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

from collections import Counter

H,W=map(int,input().split())
S=[input().strip() for i in range(H)]

A=[[0]*W for i in range(H)]

for i in range(H):
    for j in range(W):
        if S[i][j]=="#":
            A[i][j]=1


for i in range(H):
    for j in range(W):
        if (i+j)%2==1:
            A[i][j]^=1

#for a in A:
#    print(*a)

OP=int(input())

ONE=[]
TWO=[]

for i in range(OP):
    x,y=map(int,input().split())
    if x==1:
        ONE.append(y)
    else:
        TWO.append(y)

ONEX=[]
TWOX=[]

for i in range(1,H):
    for j in range(W):
        if A[i][j]!=A[i-1][j]:
            ONEX.append(i)

for i in range(H):
    for j in range(1,W):
        if A[i][j]!=A[i][j-1]:
            TWOX.append(j)

OC=Counter(ONEX)

for v in OC.values():
    if v!=W:
        print("No")
        exit()

TC=Counter(TWOX)

for v in TC.values():
    if v!=H:
        print("No")
        exit()



if set(ONEX)<set(ONE) and set(TWOX)<set(TWO):
    print("Yes")
else:
    print("No")
        
0