結果
問題 | No.1046 Fruits Rush |
ユーザー | nadeshino |
提出日時 | 2020-05-08 21:25:30 |
言語 | Nim (2.0.2) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,718 bytes |
コンパイル時間 | 4,245 ms |
コンパイル使用メモリ | 70,032 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-07-03 23:39:48 |
合計ジャッジ時間 | 5,042 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | WA | - |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
ソースコード
import algorithm, macros, math, sequtils, strutils, tables # import bitops, lenientops, deques, # heapqueue, sets, sugar let read* = iterator: string = while true: (for s in stdin.readLine.split: yield s) template input*(T: static[typedesc]): untyped = when T is int: read().parseInt elif T is float: read().parseFloat elif T is string: read() elif T is char: read()[0] macro dump*(args: varargs[typed]): untyped = result = newNimNode(nnkStmtList) for x in args: let s = toStrLit(x) result.add quote do: stderr.write `s`, " = ", `x`, " " result.add quote do: stderr.write "\n" proc `|=`*(n: var int, m: int) = n = n or m proc `|=`*(n: var bool, m: bool) = n = n or m proc `&=`*(n: var int, m: int) = n = n and m proc `&=`*(n: var bool, m: bool) = n = n and m proc `^=`*(n: var int, m: int) = n = n xor m proc `^=`*(n: var bool, m: bool) = n = n xor m proc `%=`*(n: var int, m: int) = n = n mod m proc `/=`*(n: var int, m: int) = n = n div m proc `<<=`*(n: var int, m: int) = n = n shl m proc `>>=`*(n: var int, m: int) = n = n shr m proc `<?=`*(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))) proc newSeq4*[T](n1, n2, n3, n4: Natural): seq[seq[seq[seq[T]]]] = newSeqWith(n1, newSeqWith(n2, newSeqWith(n3, newSeq[T](n4)))) # -------------------------------------------------- # let N, K = input(int) let A = newSeqWith(N, input(int)).sorted() var res = -1 * 10 ^ 18 var sum = 0 echo A for i in 1 .. K: sum += A[^i] res >?= sum echo res