結果
| 問題 | 
                            No.349 干支の置き物
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-02-22 16:37:19 | 
| 言語 | Rust  (1.83.0 + proconio)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 1 ms / 2,000 ms | 
| コード長 | 670 bytes | 
| コンパイル時間 | 13,776 ms | 
| コンパイル使用メモリ | 401,196 KB | 
| 実行使用メモリ | 6,824 KB | 
| 最終ジャッジ日時 | 2024-10-09 17:20:27 | 
| 合計ジャッジ時間 | 14,159 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 29 | 
ソースコード
use std::collections::HashMap;
fn main() {
    let mut n = String::new();
    std::io::stdin().read_line(&mut n).ok();
    let n: usize = n.trim().parse().unwrap();
    let mut eto2count: HashMap<String, usize> = HashMap::new();
    for _ in 0..n {
        let mut eto = String::new();
        std::io::stdin().read_line(&mut eto).ok();
        let eto: String = eto.trim().to_string().to_owned();
        if let Some(x) = eto2count.get_mut(&eto) {
            *x += 1;
        } else {
            eto2count.insert(eto, 1);
        }
    }
    if (n + 1) / 2 < *eto2count.values().max().unwrap() {
        println!("NO");
    } else {
        println!("YES");
    }
}