結果

問題 No.349 干支の置き物
ユーザー ldsyb
提出日時 2016-03-11 22:31:09
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 439 bytes
コンパイル時間 714 ms
コンパイル使用メモリ 68,304 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-09-25 00:58:18
合計ジャッジ時間 1,596 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 25 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <map>
using namespace std;

int main(){
   int n;
   cin >> n;
   map<string,int> m;
   for(int i = 0;i < n;i++){
      string s;
      cin >> s;
      m[s]++;
   }
   if(m.size() == 2){
      cout << "YES" << endl;
      return 0;
   }
   for(auto itr = m.begin();itr != m.end();itr++){
      if(itr->second > n / 2){
         cout << "NO" << endl;
         return 0;
      }
   }
   cout << "YES" << endl;
}
0