結果
| 問題 | 
                            No.349 干支の置き物
                             | 
                    
| コンテスト | |
| ユーザー | 
                             バカらっく
                         | 
                    
| 提出日時 | 2018-03-02 17:18:05 | 
| 言語 | Swift  (6.0.3)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 10 ms / 2,000 ms | 
| コード長 | 352 bytes | 
| コンパイル時間 | 906 ms | 
| コンパイル使用メモリ | 123,744 KB | 
| 実行使用メモリ | 9,344 KB | 
| 最終ジャッジ日時 | 2024-11-30 12:05:15 | 
| 合計ジャッジ時間 | 2,129 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 29 | 
コンパイルメッセージ
Main.swift:6:5: warning: immutable value 'i' was never used; consider replacing with '_' or removing it
for i in 0..<itemCount {
    ^
    _
            
            ソースコード
let itemCount = Int(readLine()!)!
var dic = [String:Int]()
var mx = 0
for i in 0..<itemCount {
    let nm = readLine()!
    if(dic[nm] == nil) {
        dic[nm] = 1
    } else {
        dic[nm] = dic[nm]! + 1
    }
    mx = max(mx, dic[nm]!)
}
let tmp = itemCount / 2 + (itemCount % 2)
if(mx > tmp) {
    print("NO")    
} else {
    print("YES")
}
            
            
            
        
            
バカらっく