結果
問題 | No.349 干支の置き物 |
ユーザー |
![]() |
提出日時 | 2016-03-23 23:20:50 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 433 bytes |
コンパイル時間 | 1,775 ms |
コンパイル使用メモリ | 170,844 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 07:28:33 |
合計ジャッジ時間 | 2,741 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> 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]++; } vector<int> num; for(auto& it : eto)num.push_back(it.second); sort(num.begin(),num.end()); int sum=0; for(auto& it : num)sum+=it; if(sum-num.back()>=num.back()-1)cout<<"YES"<<endl; else cout<<"NO"<<endl; return 0; }