結果
| 問題 | No.706 多眼生物の調査 | 
| コンテスト | |
| ユーザー |  バカらっく | 
| 提出日時 | 2018-07-01 01:59:05 | 
| 言語 | Swift (6.0.3) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 54 ms / 2,000 ms | 
| コード長 | 734 bytes | 
| コンパイル時間 | 1,157 ms | 
| コンパイル使用メモリ | 129,284 KB | 
| 実行使用メモリ | 9,728 KB | 
| 最終ジャッジ日時 | 2024-11-30 12:32:42 | 
| 合計ジャッジ時間 | 1,927 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 5 | 
ソースコード
class Main {
    
    func Proc() {
        let inputCount = Int(readLine()!)!
        var dic = [Int:Int]()
        var cntMax = 0
        var ans = 0
        for _ in 0..<inputCount {
            let inpt = readLine()!.map{ $0 }.filter{ $0 == "^" }.count
            if let num = dic[inpt] {
                dic[inpt] = num + 1
            } else {
                dic[inpt] = 1
            }
            if dic[inpt]! == cntMax {
                if ans < inpt {
                    ans = inpt
                    cntMax = dic[inpt]!
                }
            } else if dic[inpt]! > cntMax {
                ans = inpt
                cntMax = dic[inpt]!
            }
        }
        print(ans)
    }
    
}
Main().Proc()
            
            
            
        