結果
問題 | No.392 2分木をたどれ |
ユーザー |
|
提出日時 | 2019-01-21 12:02:03 |
言語 | Nim (1.6.4) |
結果 |
AC
|
実行時間 | 7 ms / 2,000 ms |
コード長 | 554 bytes |
コンパイル時間 | 2,571 ms |
使用メモリ | 4,904 KB |
最終ジャッジ日時 | 2023-02-01 14:46:28 |
合計ジャッジ時間 | 3,142 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,900 KB |
testcase_01 | AC | 7 ms
4,904 KB |
testcase_02 | AC | 7 ms
4,900 KB |
ソースコード
import sequtils template times*(n:int,body) = (for _ in 0..<n: body) proc getchar_unlocked():char {. importc:"getchar_unlocked",header: "<stdio.h>" .} proc scan(): int = while true: let k = getchar_unlocked() if k < '0': break result = 10 * result + k.ord - '0'.ord proc path(n:int) : string = if n == 0 : return "??" if n == 1 : return "L" if n == 2 : return "R" if n mod 2 == 1: return path(n div 2) & "L" return path((n-1) div 2) & "R" const pathes = toSeq(0..4096).mapIt(it.path) let m = scan() m.times: echo pathes[scan()]