結果

問題 No.3016 ハチマキおじさん
ユーザー lam6er
提出日時 2025-04-16 16:01:43
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 694 bytes
コンパイル時間 3,012 ms
コンパイル使用メモリ 80,200 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-04-16 16:06:32
合計ジャッジ時間 7,832 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other WA * 31
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using namespace std;

int main() {
    ios::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> result(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);
        result[i] = upper - lower;
    }

    for (int i = 0; i < M; ++i) {
        if (i > 0) cout << ' ';
        cout << result[i];
    }
    cout << endl;

    return 0;
}
0