結果
| 問題 | 
                            No.349 干支の置き物
                             | 
                    
| コンテスト | |
| ユーザー | 
                             Nagisa
                         | 
                    
| 提出日時 | 2016-03-25 19:49:28 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 2 ms / 2,000 ms | 
| コード長 | 486 bytes | 
| コンパイル時間 | 616 ms | 
| コンパイル使用メモリ | 68,192 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-17 07:28:47 | 
| 合計ジャッジ時間 | 1,573 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 29 | 
ソースコード
#include <iostream>
#include <map>
#include <string>
using namespace std;
int main() {
    int N;
    cin >> N;
    map<string, int> eto;
    for (int i = 0; i < N; i++) {
        string A;
        cin >> A;
        eto[A] += 1;
    }
    int m = 0;
    for (map<string, int>::iterator it = eto.begin(); it!=eto.end(); it++) {
            m = max(m,(*it).second);
    }
    if ((N+1)/2 >= m) {
        cout << "YES" << endl;}
    else {
        cout << "NO" << endl;}
    return 0;
}
            
            
            
        
            
Nagisa