結果

問題 No.1851 Regular Tiling
ユーザー 👑 rin204rin204
提出日時 2022-02-25 22:12:30
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 947 bytes
コンパイル時間 269 ms
コンパイル使用メモリ 86,868 KB
実行使用メモリ 79,620 KB
最終ジャッジ日時 2023-09-16 17:11:28
合計ジャッジ時間 4,883 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
71,268 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 88 ms
76,464 KB
testcase_13 WA -
testcase_14 AC 168 ms
79,620 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

"""
3以上は使えない

0 

11

22
22

22222
2...2
2...2
22222
みたいに2で囲う

のどれか

1 * n := 0 と 1 でできる
2 * n := 1 と 2 でできる
3 * n := 2 で周りを囲って間が 1 * (n - 2)
4 * n := 1 * n と 3 * n に分割すればいい

[1, 2, 3] の中で 2 * n と 3 * n だけ隣り合わせられない

011011011011
122122122122
122122122122

の繰り返しでok

"""
def solve():
    h, w = map(int, input().split())
    if h % 3 == 2:
        s = 1
    else:
        s = 0
    
    A = []
    while len(A) < h:
        if s == 1:
            A += [1, 1]
        else:
            A += [0]
        s ^= 1
    
    if w % 3 == 2:
        s = 1
    else:
        s = 0
    
    B = [a + 1 for a in A]
    while w:
        if s == 1:
            print(*B)
            print(*B)
            w -= 2
        else:
            print(*A)
            w -= 1
        s ^= 1
    
for _ in range(int(input())):
    solve()
0