結果

問題 No.3016 ハチマキおじさん
ユーザー gew1fw
提出日時 2025-06-12 18:08:50
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 738 bytes
コンパイル時間 2,297 ms
コンパイル使用メモリ 81,644 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-06-12 18:10:54
合計ジャッジ時間 5,082 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

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

    int n, m;
    cin >> n >> m;

    vector<long long> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }
    sort(a.begin(), a.end());

    vector<int> res;
    res.reserve(m);

    for (int i = 0; i < m; ++i) {
        long long b;
        cin >> b;
        auto lower = lower_bound(a.begin(), a.end(), b);
        auto upper = upper_bound(a.begin(), a.end(), b);
        res.push_back(upper - lower);
    }

    for (int i = 0; i < m; ++i) {
        if (i > 0) {
            cout << ' ';
        }
        cout << res[i];
    }
    cout << '\n';

    return 0;
}
0