結果

問題 No.349 干支の置き物
ユーザー HeyHey0111
提出日時 2016-03-13 02:03:55
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 465 bytes
コンパイル時間 609 ms
コンパイル使用メモリ 68,056 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-17 07:26:24
合計ジャッジ時間 1,559 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;
int main(void){
    // Here your code !
    map<string,int> m;
    int n;
    cin >> n;
    for(int i=0;i<n;i++){
        string x;
        cin >>x ;
        m[x]++;
    }
    int max=0;
    int sum=0;
    for (auto i = m.begin(); i != m.end(); ++i) {
        sum+=i->second;
        if(i->second>max)max=i->second;
    }
    if(sum>=2*max-1)cout<<"YES"<<endl;
    else cout<<"NO"<<endl;
    return 0;
    
}
0