Submission #2868441
Source Code Expand
import strutils
import sequtils
import algorithm
import math
import queues
import tables
import sets
import logging
import future
const INF* = int(1e18 + 373)
proc readSeq*(): seq[string] = stdin.readLine().strip().split()
proc readSeq*(n: Natural): seq[string] =
result = newSeq[string](n)
for i in 0..<n:
result[i] = stdin.readLine().strip()
proc readInt1*(): int = readSeq().map(parseInt)[0]
proc readInt2*(): (int, int) =
let a = readSeq().map(parseInt)
return (a[0], a[1])
proc readInt3*(): (int, int, int) =
let a = readSeq().map(parseInt)
return (a[0], a[1], a[2])
proc readInt4*(): (int, int, int, int) =
let a = readSeq().map(parseInt)
return (a[0], a[1], a[2], a[3])
type seq2*[T] = seq[seq[T]]
proc newSeq2*[T](n1, n2: Natural): seq2[T] = newSeqWith(n1, newSeq[T](n2))
#------------------------------------------------------------------------------#
proc main() =
let (k, t) = readInt2()
let a = readSeq().map(parseInt).sorted(cmp[int])
let s = a[0..<t - 1].sum()
echo max(0, a[t - 1] - 1 - s)
main()
Submission Info
Submission Time |
|
Task |
B - K Cakes |
User |
somq14 |
Language |
Nim (0.13.0) |
Score |
200 |
Code Size |
1090 Byte |
Status |
AC |
Exec Time |
1 ms |
Memory |
256 KB |
Compile Error
Hint: system [Processing]
Hint: Main [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint: sequtils [Processing]
Hint: algorithm [Processing]
Hint: math [Processing]
Hint: times [Processing]
Hint: queues [Processing]
Hint: tables [Processing]
Hint: hashes [Processing]
Hint: etcpriv [Processing]
Hint: sets [Processing]
Hint: os [Processing]
Hint: posix [Processing]
Hint: logging [Processing]
lib/pure/logging.nim(128, 22) Hint: 'Exception' is declared but not used [XDeclaredButNotUsed]
Hint: future [Processing]
Hint: macros [Processing]
Main.nim(36, 8) Hint: 'k' is declared but not used [XDeclaredButNotUsed]
Hint: [Link]
Hint: operation successful (24829 lines compiled; 2.736 sec total; 24.250MB; Release Build) [SuccessX]
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
200 / 200 |
Status |
|
|
Set Name |
Test Cases |
Sample |
0_000.txt, 0_001.txt, 0_002.txt |
All |
0_000.txt, 0_001.txt, 0_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt |
Case Name |
Status |
Exec Time |
Memory |
0_000.txt |
AC |
1 ms |
256 KB |
0_001.txt |
AC |
1 ms |
256 KB |
0_002.txt |
AC |
1 ms |
256 KB |
1_003.txt |
AC |
1 ms |
256 KB |
1_004.txt |
AC |
1 ms |
256 KB |
1_005.txt |
AC |
1 ms |
256 KB |
1_006.txt |
AC |
1 ms |
256 KB |
1_007.txt |
AC |
1 ms |
256 KB |
1_008.txt |
AC |
1 ms |
256 KB |
1_009.txt |
AC |
1 ms |
256 KB |