結果

問題 No.1851 Regular Tiling
ユーザー lloyzlloyz
提出日時 2022-02-26 00:05:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 197 ms / 2,000 ms
コード長 675 bytes
コンパイル時間 376 ms
コンパイル使用メモリ 86,904 KB
実行使用メモリ 80,384 KB
最終ジャッジ日時 2023-09-16 19:47:51
合計ジャッジ時間 4,155 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 67 ms
71,260 KB
testcase_01 AC 121 ms
77,588 KB
testcase_02 AC 123 ms
77,720 KB
testcase_03 AC 122 ms
77,924 KB
testcase_04 AC 122 ms
77,836 KB
testcase_05 AC 126 ms
77,720 KB
testcase_06 AC 128 ms
77,940 KB
testcase_07 AC 125 ms
77,712 KB
testcase_08 AC 131 ms
77,752 KB
testcase_09 AC 131 ms
78,372 KB
testcase_10 AC 131 ms
77,744 KB
testcase_11 AC 90 ms
76,444 KB
testcase_12 AC 82 ms
76,460 KB
testcase_13 AC 151 ms
78,392 KB
testcase_14 AC 197 ms
80,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
    h, w = map(int, input().split())
    th, tw = (h + 2) // 3, (w + 2) // 3
    T = []
    for i in range(th):
        for j in range(3):
            if j == 0:
                TEMP = [0, 1, 1] * tw
            elif j == 1:
                TEMP = [1, 2, 2] * tw
            elif j == 2:
                TEMP = [1, 2, 2] * tw
            T.append(TEMP)
    rh, rw = h % 3, w % 3
    if rh == 1:
        T = T[:-2]
    elif rh == 2:
        T = T[1:]
    if rw == 1:
        for i in range(h):
            T[i] = T[i][:-2]
    elif rw == 2:
        for i in range(h):
            T[i] = T[i][1:]
    for i in range(h):
        print(*T[i])
0