結果

問題 No.349 干支の置き物
コンテスト
ユーザー oooooba
提出日時 2021-02-07 21:52:15
言語 C++17
(gcc 15.3.0 + boost 1.92.0 + ACL)
コンパイル:
g++-15 -O2 -fplugin=/usr/lib/yukicoder/noavx512-gcc15.so -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 2,000 ms
+ 931µs
コード長 571 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 755 ms
コンパイル使用メモリ 127,056 KB
実行使用メモリ 9,916 KB
最終ジャッジ日時 2026-10-15 13:09:53
合計ジャッジ時間 2,757 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 31
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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