Submission #3806954


Source Code Expand

import future, math, strutils


proc nextString: string =
   result = ""
   while not endOfFile stdin:
      let nextChar = readChar stdin
      case nextChar
      of '\r':
         discard
      of "\n"[0], ' ':
         break
      else:
         add result, nextChar


proc nextInt: int =
   return parseInt nextString()


let
   N, K = nextInt()
   a = lc[nextInt() | (i <- 0..<N), int]
var
   ans = 0
   cnt = a[0..<K].sum


proc main: void =
   for i in 0..<N - K + 1:
      if i != 0:
         cnt += a[i + K - 1] - a[i - 1]
      ans += cnt

   writeLine stdout, ans


when isMainModule:
   main()

Submission Info

Submission Time
Task C - 総和
User ToshiroYanagi
Language Nim (0.13.0)
Score 100
Code Size 646 Byte
Status AC
Exec Time 45 ms
Memory 3184 KB

Compile Error

Hint: system [Processing]
Hint: Main [Processing]
Hint: future [Processing]
Hint: macros [Processing]
Hint: math [Processing]
Hint: times [Processing]
Hint: strutils [Processing]
Hint: parseutils [Processing]
Hint:  [Link]
Hint: operation successful (15104 lines compiled; 1.931 sec total; 16.163MB; Release Build) [SuccessX]

Judge Result

Set Name sample subtask1 subtask2
Score / Max Score 0 / 0 50 / 50 50 / 50
Status
AC × 2
AC × 13
AC × 24
Set Name Test Cases
sample sample01.txt, sample02.txt
subtask1 00.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, sample01.txt, sample02.txt
subtask2 00.txt, 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, 17.txt, 18.txt, 19.txt, sample01.txt, sample02.txt, sample01.txt, sample02.txt
Case Name Status Exec Time Memory
00.txt AC 1 ms 256 KB
01.txt AC 1 ms 256 KB
02.txt AC 1 ms 256 KB
03.txt AC 1 ms 256 KB
04.txt AC 1 ms 256 KB
05.txt AC 1 ms 256 KB
06.txt AC 1 ms 256 KB
07.txt AC 1 ms 256 KB
08.txt AC 1 ms 256 KB
09.txt AC 1 ms 256 KB
10.txt AC 1 ms 256 KB
11.txt AC 45 ms 2420 KB
12.txt AC 39 ms 2416 KB
13.txt AC 38 ms 2544 KB
14.txt AC 40 ms 2416 KB
15.txt AC 39 ms 3184 KB
16.txt AC 39 ms 3184 KB
17.txt AC 41 ms 2544 KB
18.txt AC 14 ms 2416 KB
19.txt AC 39 ms 2416 KB
sample01.txt AC 1 ms 256 KB
sample02.txt AC 1 ms 256 KB