結果
問題 | No.1851 Regular Tiling |
ユーザー | 👑 rin204 |
提出日時 | 2022-02-25 22:13:24 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 150 ms / 2,000 ms |
コード長 | 947 bytes |
コンパイル時間 | 207 ms |
コンパイル使用メモリ | 82,512 KB |
実行使用メモリ | 78,104 KB |
最終ジャッジ日時 | 2024-07-03 17:05:51 |
合計ジャッジ時間 | 3,173 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 14 |
ソースコード
""" 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(): w, h = 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()