結果

問題 No.349 干支の置き物
ユーザー oooooba
提出日時 2021-02-07 21:52:15
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 4 ms / 2,000 ms
コード長 571 bytes
コンパイル時間 1,291 ms
コンパイル使用メモリ 111,064 KB
最終ジャッジ日時 2025-01-18 14:44:16
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <array>
#include <cmath>
#include <cstdio>
#include <iostream>
#include <numeric>
#include <optional>
#include <queue>
#include <unordered_map>
#include <unordered_set>
#include <vector>

using namespace std;

int main() {
    int32_t n;
    cin >> n;
    unordered_map<string, int32_t> mp;
    for (auto i = 0; i < n; ++i) {
        string a;
        cin >> a;
        ++mp[a];
    }
    int32_t mx = 0;
    for (auto &&p : mp) {
        mx = max(mx, p.second);
    }
    cout << (mx <= (n + 1) / 2 ? "YES" : "NO") << endl;
    return 0;
}
0