Submission #52563372


Source Code Expand

// AtCoder Beginner Contest 350

import Foundation

func main() {
    let (N, Q) = read2Ints()
    let teeths = readInts()
    var lists = Array(repeating: 1, count: N)

    for v in teeths {
        if lists[v-1] == 0 {
            lists[v-1] = 1
        }else{
            lists[v-1] = 0
        }
    }
    print(lists.reduce(0, {sum, number in sum + number }))

}
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) }
}

Submission Info

Submission Time
Task B - Dentist Aoki
User akidon0000
Language Swift (swift 5.8.1)
Score 200
Code Size 2431 Byte
Status AC
Exec Time 5 ms
Memory 15012 KiB

Compile Error

[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
/judge/Sources/main.swift:6:13: warning: immutable value 'Q' was never used; consider replacing with '_' or removing it
    let (N, Q) = read2Ints()
            ^
            _
[13/14] Linking Main
Build complete! (10.15s)

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 20
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt
Case Name Status Exec Time Memory
sample_01.txt AC 5 ms 14800 KiB
sample_02.txt AC 5 ms 14988 KiB
sample_03.txt AC 5 ms 14992 KiB
test_01.txt AC 5 ms 14720 KiB
test_02.txt AC 5 ms 14840 KiB
test_03.txt AC 5 ms 14944 KiB
test_04.txt AC 5 ms 14992 KiB
test_05.txt AC 5 ms 14804 KiB
test_06.txt AC 5 ms 14728 KiB
test_07.txt AC 5 ms 14968 KiB
test_08.txt AC 5 ms 14720 KiB
test_09.txt AC 5 ms 14748 KiB
test_10.txt AC 5 ms 14768 KiB
test_11.txt AC 5 ms 14996 KiB
test_12.txt AC 5 ms 15004 KiB
test_13.txt AC 5 ms 14768 KiB
test_14.txt AC 5 ms 14780 KiB
test_15.txt AC 5 ms 15012 KiB
test_16.txt AC 5 ms 14792 KiB
test_17.txt AC 5 ms 14772 KiB