結果

問題 No.1851 Regular Tiling
ユーザー hir355hir355
提出日時 2022-02-26 00:37:34
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 203 ms / 2,000 ms
コード長 587 bytes
コンパイル時間 748 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 81,000 KB
最終ジャッジ日時 2023-09-16 20:34:25
合計ジャッジ時間 4,908 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,052 KB
testcase_01 AC 165 ms
77,932 KB
testcase_02 AC 172 ms
78,628 KB
testcase_03 AC 162 ms
78,396 KB
testcase_04 AC 165 ms
78,776 KB
testcase_05 AC 165 ms
78,804 KB
testcase_06 AC 173 ms
79,000 KB
testcase_07 AC 162 ms
78,132 KB
testcase_08 AC 165 ms
78,612 KB
testcase_09 AC 165 ms
78,576 KB
testcase_10 AC 156 ms
79,152 KB
testcase_11 AC 94 ms
76,772 KB
testcase_12 AC 90 ms
76,652 KB
testcase_13 AC 171 ms
79,264 KB
testcase_14 AC 203 ms
81,000 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

t = int(input())
for _ in range(t):
    h, w = map(int, input().split())
    ans = [[0] * w for _ in range(h)]
    for i in range(h):
        for j in range(w):
            if h % 3 == 1:
                ht = (i % 3 == 0)
            else:
                ht = (i % 3 == 2)
            if w % 3 == 1:
                wt = (j % 3 == 0)
            else:
                wt = (j % 3 == 2)
            if ht and wt:
                ans[i][j] = 0
            elif ht or wt:
                ans[i][j] = 1
            else:
                ans[i][j] = 2
    for row in ans:
        print(*row)
0