結果

問題 No.1851 Regular Tiling
ユーザー vwxyzvwxyz
提出日時 2023-07-15 15:32:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 521 ms / 2,000 ms
コード長 483 bytes
コンパイル時間 97 ms
コンパイル使用メモリ 11,840 KB
実行使用メモリ 10,864 KB
最終ジャッジ日時 2023-10-17 01:54:00
合計ジャッジ時間 5,772 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
10,072 KB
testcase_01 AC 143 ms
10,672 KB
testcase_02 AC 170 ms
10,656 KB
testcase_03 AC 163 ms
10,652 KB
testcase_04 AC 156 ms
10,752 KB
testcase_05 AC 159 ms
10,764 KB
testcase_06 AC 180 ms
10,732 KB
testcase_07 AC 149 ms
10,644 KB
testcase_08 AC 153 ms
10,656 KB
testcase_09 AC 177 ms
10,700 KB
testcase_10 AC 162 ms
10,768 KB
testcase_11 AC 30 ms
10,320 KB
testcase_12 AC 31 ms
10,400 KB
testcase_13 AC 283 ms
10,864 KB
testcase_14 AC 521 ms
10,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
readline=sys.stdin.readline

T=int(readline())
lst=[[0,1,1],[1,2,2],[1,2,2]]
for t in range(T):
    H,W=map(int,readline().split())
    if H%3==0:
        Hl,Hr=0,H
    elif H%3==1:
        Hl,Hr=0,H
    elif H%3==2:
        Hl,Hr=-2,H-2
    if W%3==0:
        Wl,Wr=0,W
    elif W%3==1:
        Wl,Wr=0,W
    elif W%3==2:
        Wl,Wr=-2,W-2
    ans_lst=[[lst[h%3][w%3] for w in range(Wl,Wr)] for h in range(Hl,Hr)]
    for h in range(H):
        print(*ans_lst[h])
    
0