結果
問題 | No.1851 Regular Tiling |
ユーザー | Mitarushi |
提出日時 | 2022-02-24 22:59:23 |
言語 | Nim (2.0.2) |
結果 |
AC
|
実行時間 | 88 ms / 2,000 ms |
コード長 | 1,116 bytes |
コンパイル時間 | 4,606 ms |
コンパイル使用メモリ | 68,984 KB |
実行使用メモリ | 4,840 KB |
最終ジャッジ日時 | 2023-09-16 15:10:38 |
合計ジャッジ時間 | 6,594 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 26 ms
4,376 KB |
testcase_02 | AC | 30 ms
4,384 KB |
testcase_03 | AC | 29 ms
4,412 KB |
testcase_04 | AC | 28 ms
4,468 KB |
testcase_05 | AC | 29 ms
4,488 KB |
testcase_06 | AC | 32 ms
4,380 KB |
testcase_07 | AC | 27 ms
4,528 KB |
testcase_08 | AC | 29 ms
4,580 KB |
testcase_09 | AC | 32 ms
4,380 KB |
testcase_10 | AC | 29 ms
4,520 KB |
testcase_11 | AC | 3 ms
4,376 KB |
testcase_12 | AC | 2 ms
4,380 KB |
testcase_13 | AC | 53 ms
4,772 KB |
testcase_14 | AC | 88 ms
4,840 KB |
ソースコード
import strutils, sequtils proc gen_one_two(x: int): seq[int] = result = @[] if x mod 3 == 2: result.add(2) for _ in 0..<x div 3: result.add(1) result.add(2) if x mod 3 == 1: result.add(1) proc set_tile(map: var seq[seq[int]], x, y, h, w: int) = for i in 0..<h: for j in 0..<w: map[i + x][j + y] = h * w div 2 proc solve() = var h, w: int (h, w) = stdin.readLine.split.map parseInt assert 1 <= h and h <= 100 assert 1 <= w and w <= 100 let w_tile = gen_one_two(w) h_tile = gen_one_two(h) var map = newSeqWith(h, newSeq[int](w)) var acc_h = 0 for i in h_tile: var acc_w = 0 for j in w_tile: set_tile(map, acc_h, acc_w, i, j) acc_w += j acc_h += i for i in map: echo i.map(proc(x: int): string = $x).join(" ") proc last_check() = try: let x = stdin.readLine assert x == "" except EOFError: return let t = stdin.readLine.parseInt assert 1 <= t and t <= 100 for _ in 0..<t: solve() last_check()