Submission #34007950
Source Code Expand
Copy
def main(A, B):def proc(A, B):A1 = []for br in B:while A:ar = A.pop(0)if set(br).issubset(set(ar)):A1.append(ar)breakelse:return Nonereturn A1A1 = proc(A, B)if not A1: return "No"A2 = proc(list(zip(*A1)), list(zip(*B)))if not A2: return "No"return "Yes"
def main(A, B): def proc(A, B): A1 = [] for br in B: while A: ar = A.pop(0) if set(br).issubset(set(ar)): A1.append(ar) break else: return None return A1 A1 = proc(A, B) if not A1: return "No" A2 = proc(list(zip(*A1)), list(zip(*B))) if not A2: return "No" return "Yes" H1, W1= map(int, input().split()) A = [list(map(int, input().split())) for _ in range(H1)] H2, W2= map(int, input().split()) B = [list(map(int, input().split())) for _ in range(H2)] print(main(A, B))
Submission Info
Submission Time | |
---|---|
Task | C - Matrix Reducing |
User | arakaki_tokyo |
Language | PyPy3 (7.3.0) |
Score | 300 |
Code Size | 696 Byte |
Status | AC |
Exec Time | 80 ms |
Memory | 62096 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example0.txt, example1.txt |
All | 000.txt, 001.txt, 002.txt, 003.txt, 004.txt, 005.txt, 006.txt, 007.txt, 008.txt, 009.txt, 010.txt, 011.txt, 012.txt, 013.txt, 014.txt, 015.txt, 016.txt, 017.txt, 018.txt, 019.txt, 020.txt, 021.txt, 022.txt, 023.txt, 024.txt, 025.txt, 026.txt, 027.txt, 028.txt, 029.txt, example0.txt, example1.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
000.txt | AC | 80 ms | 61640 KB |
001.txt | AC | 53 ms | 61680 KB |
002.txt | AC | 56 ms | 62064 KB |
003.txt | AC | 53 ms | 62096 KB |
004.txt | AC | 55 ms | 61716 KB |
005.txt | AC | 55 ms | 61952 KB |
006.txt | AC | 55 ms | 62048 KB |
007.txt | AC | 53 ms | 61980 KB |
008.txt | AC | 54 ms | 61948 KB |
009.txt | AC | 58 ms | 62092 KB |
010.txt | AC | 53 ms | 61976 KB |
011.txt | AC | 54 ms | 61992 KB |
012.txt | AC | 55 ms | 61988 KB |
013.txt | AC | 56 ms | 61984 KB |
014.txt | AC | 49 ms | 61768 KB |
015.txt | AC | 58 ms | 61916 KB |
016.txt | AC | 56 ms | 61900 KB |
017.txt | AC | 49 ms | 61920 KB |
018.txt | AC | 55 ms | 61924 KB |
019.txt | AC | 55 ms | 61976 KB |
020.txt | AC | 54 ms | 62028 KB |
021.txt | AC | 55 ms | 62012 KB |
022.txt | AC | 52 ms | 61880 KB |
023.txt | AC | 59 ms | 62056 KB |
024.txt | AC | 51 ms | 61852 KB |
025.txt | AC | 55 ms | 62000 KB |
026.txt | AC | 53 ms | 61728 KB |
027.txt | AC | 56 ms | 61656 KB |
028.txt | AC | 56 ms | 61936 KB |
029.txt | AC | 55 ms | 62028 KB |
example0.txt | AC | 55 ms | 61656 KB |
example1.txt | AC | 53 ms | 61884 KB |