結果
問題 | No.897 compαctree |
ユーザー |
![]() |
提出日時 | 2019-10-04 23:07:48 |
言語 | Nim (2.2.0) |
結果 |
CE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,708 bytes |
コンパイル時間 | 1,156 ms |
コンパイル使用メモリ | 71,760 KB |
最終ジャッジ日時 | 2024-11-14 21:42:53 |
合計ジャッジ時間 | 1,863 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
stack trace: (most recent call last) Main.nim(7, 9) unpack /home/judge/data/code/Main.nim(35, 14) template/generic instantiation of `input` from here /home/judge/data/code/Main.nim(13, 44) template/generic instantiation of `unpack` from here /home/judge/data/code/Main.nim(7, 9) Error: index 1 not in 0 .. 0
ソースコード
#import algorithm, future, macros, math, sequtils, sets, strutils, tablesimport algorithm, sugar, macros, math, sequtils, sets, strutils, tablesmacro unpack(rhs: seq, cnt: static[int]): auto =let t = genSym(); result = quote do:(let `t` = `rhs`;())if NimMinor <= 17:for i in 0..<cnt: result[0][1].add(quote do:`t`[`i`])else:for i in 0..<cnt: result[1].add(quote do:`t`[`i`])template input(T: typedesc, cnt: Natural = 1): untyped =let line = stdin.readLine.split(" ")when T is int: line.map(parseInt).unpack(cnt)elif T is float: line.map(parseFloat).unpack(cnt)elif T is string: line.unpack(cnt)elif T is char: line.mapIt(it[0]).unpack(cnt)elif T is seq[int]: line.map(parseint)elif T is seq[float]: line.map(parseFloat)elif T is seq[string]: lineelif T is seq[char]: line.mapIt(it[0])proc `&=`(n: var int, m: int) = n = n and mproc `|=`(n: var int, m: int) = n = n or mproc `%=`(n: var int, m: int) = n = n mod mproc `//=`(n: var int, m: int) = n = n div mproc `<<=`(n: var int, m: int) = n = n shl mproc `>>=`(n: var int, m: int) = n = n shr mproc `<?=`(n: var SomeNumber, m: SomeNumber) = n = min(n, m)proc `>?=`(n: var SomeNumber, m: SomeNumber) = n = max(n, m)proc newSeq2[T](n1, n2: Natural): seq[seq[T]] = newSeqWith(n1, newSeq[T](n2))proc newSeq3[T](n1, n2, n3: Natural): seq[seq[seq[T]]] = newSeqWith(n1, newSeqWith(n2, newSeq[T](n3)))# -------------------------------------------------- #var Q = input(int)for query in 1 .. Q:var (N, K) = input(int, 2)if K == 1:echo N - 1else:var sum = 0for T in 0 .. 100000:sum += K ^ Tif sum >= N:echo Tbreak