結果
問題 | No.1954 CHECKER×CHECKER(2) |
ユーザー | chineristAC |
提出日時 | 2022-05-20 23:30:02 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,870 bytes |
コンパイル時間 | 141 ms |
コンパイル使用メモリ | 81,980 KB |
実行使用メモリ | 73,972 KB |
最終ジャッジ日時 | 2024-09-20 09:57:02 |
合計ジャッジ時間 | 2,694 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 47 ms
58,204 KB |
testcase_01 | AC | 43 ms
56,876 KB |
testcase_02 | AC | 44 ms
57,876 KB |
testcase_03 | AC | 44 ms
57,424 KB |
testcase_04 | AC | 44 ms
57,524 KB |
testcase_05 | AC | 43 ms
56,432 KB |
testcase_06 | AC | 43 ms
56,836 KB |
testcase_07 | AC | 44 ms
57,048 KB |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | AC | 44 ms
57,500 KB |
testcase_11 | AC | 45 ms
56,820 KB |
testcase_12 | AC | 44 ms
57,104 KB |
testcase_13 | AC | 55 ms
66,260 KB |
testcase_14 | RE | - |
testcase_15 | AC | 46 ms
57,528 KB |
testcase_16 | AC | 46 ms
56,616 KB |
testcase_17 | AC | 45 ms
57,284 KB |
testcase_18 | RE | - |
testcase_19 | AC | 45 ms
57,832 KB |
testcase_20 | RE | - |
testcase_21 | WA | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | AC | 53 ms
67,408 KB |
testcase_25 | WA | - |
testcase_26 | AC | 45 ms
57,172 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | RE | - |
testcase_31 | AC | 46 ms
57,108 KB |
ソースコード
import sys,random,bisect from collections import deque,defaultdict import heapq from itertools import permutations from math import gcd input = lambda :sys.stdin.readline().rstrip() mi = lambda :map(int,input().split()) li = lambda :list(mi()) def calc(h,w,A,f): if not f: if A[-1][-1]!=0: return False c = [A[h-1][j] for j in range(w-1)] r = [A[i][w-1] for i in range(h-1)] for i in range(h-1): for j in range(w-1): if A[i][j]!=r[i]^c[j]: return False return True else: B = [[A[i][j] for j in range(w)] for i in range(h)] if calc(h,w,B,False): return True for j in range(w): B[h-1][w-1] ^= 1 if calc(h,w,B,False): return True return False H,W = mi() A = [[(i+j)&1 for j in range(W)] for i in range(H)] for i in range(H): S = input() for j in range(W): if S[j]=="#": A[i][j] ^= 1 M = int(input()) row = [-1] column = [-1] for _ in range(M): t,n = mi() if t==1: row.append(n-1) else: column.append(n-1) f = False if H-1 not in row: row.append(H-1) else: f = True if W-1 not in column: column.append(W-1) else: f = True row.sort() column.sort() h = len(row)-1 w = len(column)-1 new_A = [[0]*w for i in range(h)] for i in range(h): for j in range(w): rl,rr = row[i]+1,row[i+1] cl,cr = column[i]+1,column[i+1] t = A[rl][cl] for p in range(rl,rr+1): for q in range(cl,cr+1): if t!=A[p][q]: exit(print("No")) new_A[i][j] = t #print(h,w,new_A,f) if calc(h,w,new_A,f): exit(print("Yes")) new_A = [[new_A[i][j]^1 for j in range(w)] for i in range(h)] if calc(h,w,new_A,f): exit(print("Yes")) print("No")