結果
問題 |
No.3197 Frequency Counter
|
ユーザー |
![]() |
提出日時 | 2025-07-03 20:38:34 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 590 ms / 2,000 ms |
コード長 | 1,010 bytes |
コンパイル時間 | 1,954 ms |
コンパイル使用メモリ | 202,744 KB |
実行使用メモリ | 17,280 KB |
最終ジャッジ日時 | 2025-07-11 07:29:17 |
合計ジャッジ時間 | 7,264 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 21 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; int main() { cin.tie(nullptr); ios::sync_with_stdio(false); int N; cin >> N; assert(1 <= N && N <= 200000); vector<ll> A(N); for (int i = 0; i < N; i++) { cin >> A[i]; assert(1 <= A[i] && A[i] <= 1000000000LL); } 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; assert(1 <= Q && Q <= 200000); for (int i = 0; i < Q; i++) { ll x; int k; cin >> x >> k; assert(1 <= x && x <= 1000000000LL); assert(1 <= k && k <= N); if (freq.find(x) == freq.end()) { cout << "No" << endl; } else { if (freq[x] >= k) cout << "Yes" << endl; else cout << "No" << endl; } } }