結果
問題 | No.349 干支の置き物 |
ユーザー | KKT89 |
提出日時 | 2020-06-09 02:52:19 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 425 bytes |
コンパイル時間 | 1,212 ms |
コンパイル使用メモリ | 84,820 KB |
最終ジャッジ日時 | 2025-01-11 00:19:31 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <map> using namespace std; typedef long long int ll; int main(){ cin.tie(nullptr); ios::sync_with_stdio(false); int n; cin >> n; map<string,int> mp; for(int i=0;i<n;i++){ string s; cin >> s; mp[s]++; } int res=0; for(auto p:mp){ res=max(res,p.second); } if(n-res>=res-1){ printf("YES\n"); } else{ printf("NO\n"); } }