Submission #42891122


Source Code Expand

import Foundation

func main() {
  var scanner = Scanner()
  let N = scanner.read(Int.self)
  let A = scanner.read(Int.self, count: N * 7)
  for i in 0 ..< N {
    print(A[i * 7 ..< i * 7 + 7].reduce(0, +), terminator: " ")
  }
}

main()

struct Scanner {
  private var tokens = [String]()
  private var index = 0
  
  mutating func read<T>(_ type: T.Type) -> T where T: LosslessStringConvertible {
    T(read())!
  }
  
  mutating func read<T>(_ type: T.Type, count n: Int) -> [T] where T: LosslessStringConvertible {
    (0 ..< n).map { _ in read(type) }
  }
  
  private mutating func read() -> String {
    while tokens.count == index {
      tokens = readLine()!.split(separator: " ").map(\.description)
      index = 0
    }
    defer {
      index += 1
    }
    return tokens[index]
  }
}

Submission Info

Submission Time
Task A - Weekly Records
User semisagi
Language Swift (5.2.1)
Score 100
Code Size 835 Byte
Status AC
Exec Time 70 ms
Memory 13400 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 100 / 100
Status
AC × 2
AC × 10
Set Name Test Cases
Sample sample_01.txt, sample_02.txt
All random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, sample_01.txt, sample_02.txt
Case Name Status Exec Time Memory
random_01.txt AC 70 ms 13044 KiB
random_02.txt AC 10 ms 13036 KiB
random_03.txt AC 10 ms 13200 KiB
random_04.txt AC 11 ms 12928 KiB
random_05.txt AC 10 ms 13396 KiB
random_06.txt AC 12 ms 12952 KiB
random_07.txt AC 15 ms 13000 KiB
random_08.txt AC 12 ms 12752 KiB
sample_01.txt AC 11 ms 13400 KiB
sample_02.txt AC 15 ms 13032 KiB