結果
問題 | No.349 干支の置き物 |
ユーザー |
![]() |
提出日時 | 2018-08-10 00:20:08 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 768 bytes |
コンパイル時間 | 824 ms |
コンパイル使用メモリ | 83,908 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-23 05:19:17 |
合計ジャッジ時間 | 1,813 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include<iostream> #include<string> #include<algorithm> #include<functional> #include<vector> #include<set> #include<queue> #include<list> #include<stdio.h> #include<stdlib.h> #include<map> #define rep(i,a,b) for(int i=a;i<b;i++) #define rrep(i,a,b) for(int i=a;i>=b;i--) #define fore(i,a) for(auto &i:a) #define all(x) (x).begin(),(x).end() typedef long long ll; using namespace std; int main() { int n; cin >> n; map<string, int> a; for (int i = 0; i < n; i++) { string buf; cin >> buf; ++a[buf]; } vector<int> b; fore(i, a) { b.push_back(i.second); } sort ( b.begin(), b.end(), greater<int>()); int max = b.front(); int limit = (n + 2 - 1) / 2; if (max > limit) { cout << "NO" << endl; } else { cout << "YES" << endl; } }