結果
| 問題 |
No.1851 Regular Tiling
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-02-24 22:59:23 |
| 言語 | Nim (2.2.0) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 1,116 bytes |
| コンパイル時間 | 1,193 ms |
| コンパイル使用メモリ | 66,564 KB |
| 最終ジャッジ日時 | 2024-07-03 15:26:51 |
| 合計ジャッジ時間 | 1,708 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
/home/judge/data/code/Main.nim(20, 34) Error: type mismatch: got 'seq[int]' for 'map(split(readLine(stdin), {' ', '\t', '\v', '\r', '\n', '\f'}, -1), parseInt)' but expected 'tuple'
ソースコード
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()