結果

問題 No.3197 Frequency Counter
ユーザー Nauclhlt🪷
提出日時 2025-07-03 20:30:56
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 686 ms / 2,000 ms
コード長 934 bytes
コンパイル時間 2,087 ms
コンパイル使用メモリ 202,564 KB
実行使用メモリ 17,280 KB
最終ジャッジ日時 2025-07-10 14:46:59
合計ジャッジ時間 7,552 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

using ll = long long;

void validateLowerString(string& s)
{
    for (int i = 0; i < s.size(); i++)
    {
        assert(islower(s[i]));
    }
}

int main()
{
    cin.tie(nullptr);
    ios::sync_with_stdio(false);

    int N;
    cin >> N;
    vector<ll> A(N);
    for (int i = 0; i < N; i++)
    {
        cin >> A[i];
    }

    map<ll, int> freq;
    for (int i = 0; i < N; i++)
    {
        if (freq.find(A[i]) != freq.end())
        {
            freq[A[i]]++;
        }
        else
        {
            freq[A[i]] = 1;
        }
    }

    int Q;
    cin >> Q;

    for (int i = 0; i < Q; i++)
    {
        ll x;
        int k;
        cin >> x >> k;
        if (freq.find(x) == freq.end())
        {
            cout << "No" << endl;
        }
        else
        {
            if (freq[x] >= k) cout << "Yes" << endl;
            else cout << "No" << endl;
        }
    }
}
0