Submission #52313030


Source Code Expand

// AtCoder Beginner Contest 349

import Foundation

func main() {
    let str = readString()
    var dic: Dictionary<Character, Int> = [:]
    for char in str {
        if let _ = dic[char] {
            dic[char]! += 1
        }else{
            dic[char] = 1
        }
    }

    var dic2: Dictionary<Int, Int> = [:]
    for (_, v) in dic {
        if let _ = dic2[v] {
            dic2[v]! += 1
        }else{
            dic2[v] = 1
        }
    }

    for (_, v) in dic2 {
        if v != 2 {
            print("No")
            return
        }
    }
    print("Yes")
}
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 - Commencement
User akidon0000
Language Swift (swift 5.8.1)
Score 200
Code Size 2653 Byte
Status AC
Exec Time 4 ms
Memory 14952 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
[13/14] Linking Main
Build complete! (9.04s)

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 200 / 200
Status
AC × 3
AC × 17
Set Name Test Cases
Sample 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt
All 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 02_handmade_01.txt, 02_handmade_02.txt, 02_handmade_03.txt, 02_handmade_04.txt
Case Name Status Exec Time Memory
00_sample_01.txt AC 4 ms 14792 KiB
00_sample_02.txt AC 4 ms 14712 KiB
00_sample_03.txt AC 4 ms 14716 KiB
01_random_01.txt AC 4 ms 14808 KiB
01_random_02.txt AC 4 ms 14820 KiB
01_random_03.txt AC 4 ms 14784 KiB
01_random_04.txt AC 4 ms 14804 KiB
01_random_05.txt AC 4 ms 14952 KiB
01_random_06.txt AC 4 ms 14832 KiB
01_random_07.txt AC 4 ms 14848 KiB
01_random_08.txt AC 4 ms 14720 KiB
01_random_09.txt AC 4 ms 14704 KiB
01_random_10.txt AC 4 ms 14732 KiB
02_handmade_01.txt AC 4 ms 14744 KiB
02_handmade_02.txt AC 4 ms 14884 KiB
02_handmade_03.txt AC 4 ms 14736 KiB
02_handmade_04.txt AC 4 ms 14864 KiB