結果
問題 | No.349 干支の置き物 |
ユーザー |
![]() |
提出日時 | 2016-03-11 22:25:09 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 2,000 ms |
コード長 | 522 bytes |
コンパイル時間 | 1,703 ms |
コンパイル使用メモリ | 168,288 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-17 07:21:09 |
合計ジャッジ時間 | 2,381 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define FOR(i,n) for(int i = 0 ;i < (n); i++) #define sz(c) ((int)c.size()) #define ten(n) ((int)1e##n) typedef long long ll; typedef pair<ll, ll> Pll; typedef pair<int, int> Pii; int main() { int n; cin >> n; map<string, int> mp; FOR(i, n) { string s; cin >> s; mp[s]++; } vector<int> x; for (auto& kv : mp) x.push_back(kv.second); int mx = *max_element(x.begin(), x.end()); int el = n - mx; bool ok = mx - el <= 1; puts(ok ? "YES" : "NO"); return 0; }