結果

問題 No.1851 Regular Tiling
ユーザー tamatotamato
提出日時 2022-02-25 21:43:04
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 176 ms / 2,000 ms
コード長 639 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 87,744 KB
実行使用メモリ 80,632 KB
最終ジャッジ日時 2023-09-16 16:26:49
合計ジャッジ時間 3,818 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,556 KB
testcase_01 AC 114 ms
78,312 KB
testcase_02 AC 128 ms
78,636 KB
testcase_03 AC 117 ms
78,420 KB
testcase_04 AC 113 ms
78,632 KB
testcase_05 AC 111 ms
78,176 KB
testcase_06 AC 118 ms
78,396 KB
testcase_07 AC 113 ms
78,276 KB
testcase_08 AC 110 ms
78,532 KB
testcase_09 AC 114 ms
78,500 KB
testcase_10 AC 114 ms
78,188 KB
testcase_11 AC 83 ms
76,852 KB
testcase_12 AC 79 ms
76,916 KB
testcase_13 AC 141 ms
79,468 KB
testcase_14 AC 176 ms
80,632 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 1000000007
eps = 10**-9


def main():
    import sys
    input = sys.stdin.readline

    G = [[0, 1, 1],
         [1, 2, 2],
         [1, 2, 2]
         ]

    for _ in range(int(input())):
        H, W = map(int, input().split())
        if H % 3 == 2:
            h0 = 1
        else:
            h0 = 0
        if W % 3 == 2:
            w0 = 1
        else:
            w0 = 0
        ans = [[0] * W for _ in range(H)]
        for h in range(H):
            for w in range(W):
                ans[h][w] = G[(h + h0) % 3][(w + w0) % 3]
        for h in range(H):
            print(*ans[h])


if __name__ == '__main__':
    main()
0