結果
| 問題 |
No.918 LISGRID
|
| コンテスト | |
| ユーザー |
maspy
|
| 提出日時 | 2020-03-21 12:07:52 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 965 bytes |
| コンパイル時間 | 145 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 57,052 KB |
| 最終ジャッジ日時 | 2024-12-21 12:47:19 |
| 合計ジャッジ時間 | 33,678 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 7 WA * 29 |
ソースコード
#!/usr/bin/ python3.8
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
import numpy as np
H, W = map(int, readline().split())
A = np.array(readline().split(), np.int64)
B = np.array(readline().split(), np.int64)
A.sort()
B.sort()
L = 1
R = H * W
C = np.zeros((H, W), np.int64)
D = C[:]
while True:
H, W = D.shape
if not H:
break
if not W:
break
if B[0] >= 2:
D[0] = L + np.arange(W)
L += W
n = A[0]
D[0][n-1:] = D[0][n-1:][::-1]
A = A[1:]
B -= 1
D = D[1:]
continue
if A[0] >= 2:
A, B = B, A
D = D.T
continue
assert A[0] == 1
n = np.count_nonzero(B <= 1)
D[0][n:] = L + np.arange(W - n)
D[0][:n] = R - np.arange(n)
L += W - n
R -= n
A = A[1:]
B[n:] -= 1
D = D[1:]
continue
print('\n'.join(' '.join(row) for row in C.astype(str)))
maspy