結果
問題 |
No.2981 Pack Tree into Grid
|
ユーザー |
|
提出日時 | 2024-11-23 16:23:09 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,611 bytes |
コンパイル時間 | 420 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-12-04 23:30:19 |
合計ジャッジ時間 | 7,412 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | WA * 1 |
other | WA * 28 |
ソースコード
# フォーマットチェック import re import sys content = input() pattern = r'^(\d+)$' result = re.match(pattern, content) if not result: sys.exit("format error.") Q = int(content) if not (1 <= Q and Q <= 2024): sys.exit("Q") for _ in range(Q): content = input() pattern = r'^(\d+)$' result = re.match(pattern, content) if not result: sys.exit("format error.") N = int(content) if not (1 <= N): sys.exit("N") ws = [] for __ in range(N - 1): content = input() pattern = r'^(\d+) (\d+) (\d+)$' result = re.match(pattern, content) if not result: sys.exit("format error.") u, v, w = map(int, content.split()) if not (1 <= u and u < v and v <= N): sys.exit("u, v") ws.append(w) # 木であるかはチェックしていない content = input() pattern = r'^(\d+) (\d+)$' result = re.match(pattern, content) if not result: sys.exit("format error.") H, W = map(int, content.split()) if not (1 <= H and H <= 12): sys.exit("H") if not (1 <= W and W <= 25): sys.exit("W") if not (N <= H * W): sys.exit("N") for i in range(N - 1): if not (ws[i] <= H * W): sys.exit("w") for __ in range(H): content = input() pattern = r'^(.|#){' + str(W) + '}$' result = re.match(pattern, content) if not result: sys.exit("format error.") # 塗り方が木的であるかはチェックしていない print("OK")