提出 #53603805


ソースコード 拡げる

// AtCoder Beginner Contest 354

import Foundation
import Collections

let YES = "Yes"
let NO = "No"

func main() {
  let num = readInt()

  var sum = 0
  var set:[String] = []
  for _ in 0..<num {
    let (s, c) = read2Strings()
    sum += Int(c)!
    set.append(s)
  }
  let sSet = set.sorted()
  print(sSet[sum % num])
}

main()



// MARK: - 入力

// 参考:
// https://github.com/kntkymt/AtCoderBeginnersSelection_Swift

 func readInt() -> Int {
     return Int(Int64(readLine()!)!)
 }

func read2Ints(separator: String.Element = " ") -> (a: Int, b: Int) {
    let ints = readLine()!.split(separator: separator).map { Int(String($0))! }
    return (a: ints[0], b: ints[1])
}

func read3Ints(separator: String.Element = " ") -> (a: Int, b: Int, c: Int) {
    let ints = readLine()!.split(separator: separator).map { Int(String($0))! }
    return (a: ints[0], b: ints[1], c: ints[2])
}

func read4Ints(separator: String.Element = " ") -> (a: Int, b: Int, c: Int, d: Int) {
    let ints = readLine()!.split(separator: separator).map { Int(String($0))! }
    return (a: ints[0], b: ints[1], c: ints[2], d: ints[3])
}

func readInts(separator: String.Element = " ") -> [Int] {
    return readLine()!.split(separator: separator).map { Int(String($0))! }
}

func readIntsFromNoSpace() -> [Int] {
    return readLine()!.map { Int(String($0))! }
}

func readString() -> String {
    return readLine()!
}

func read2Strings(separator: String.Element = " ") -> (a: String, b: String) {
    let strings = readLine()!.split(separator: separator).map { String($0) }
    return (a: strings[0], b: strings[1])
}

func read3Strings(separator: String.Element = " ") -> (a: String, b: String, c: String) {
    let strings = readLine()!.split(separator: separator).map { String($0) }
    return (a: strings[0], b: strings[1], c: strings[2])
}

func read4Strings(separator: String.Element = " ") -> (a: String, b: String, c: String, d: String) {
    let strings = readLine()!.split(separator: separator).map { String($0) }
    return (a: strings[0], b: strings[1], c: strings[2], d: strings[3])
}

func readStrings(separator: String.Element = " ") -> [String] {
    return readLine()!.split(separator: separator).map { String($0) }
}

func readStringsFromNoSpace() -> [String] {
    return readLine()!.map { String($0) }
}

提出情報

提出日時
問題 B - AtCoder Janken 2
ユーザ akidon0000
言語 Swift (swift 5.8.1)
得点 200
コード長 2393 Byte
結果 AC
実行時間 4 ms
メモリ 14932 KiB

コンパイルエラー

[0/1] Planning build
Building for production...
[0/2] Compiling _NumericsShims _NumericsShims.c
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[2/3] Compiling RealModule AlgebraicField.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[4/5] Compiling OrderedCollections _HashTable+Bucket.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[6/7] Compiling DequeModule Compatibility.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[8/9] Compiling Algorithms AdjacentPairs.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[10/11] Compiling Collections Collections.swift
remark: Incremental compilation has been disabled: it is not compatible with whole module optimization
[12/13] Compiling Main main.swift
[13/14] Linking Main
Build complete! (9.21s)

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 200 / 200
結果
AC × 2
AC × 14
セット名 テストケース
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_hand_00.txt, 01_hand_01.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt
ケース名 結果 実行時間 メモリ
00_sample_00.txt AC 4 ms 14280 KiB
00_sample_01.txt AC 4 ms 14348 KiB
01_hand_00.txt AC 4 ms 14380 KiB
01_hand_01.txt AC 4 ms 14728 KiB
02_random_00.txt AC 4 ms 14552 KiB
02_random_01.txt AC 3 ms 14352 KiB
02_random_02.txt AC 4 ms 14424 KiB
02_random_03.txt AC 4 ms 14444 KiB
02_random_04.txt AC 4 ms 14652 KiB
02_random_05.txt AC 4 ms 14764 KiB
02_random_06.txt AC 4 ms 14676 KiB
02_random_07.txt AC 4 ms 14932 KiB
02_random_08.txt AC 4 ms 14844 KiB
02_random_09.txt AC 4 ms 14684 KiB