結果

問題 No.8016 unordered_mapなるたけ落とすマン
ユーザー trineutron
提出日時 2020-09-21 15:47:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 295 ms / 1,000 ms
コード長 557 bytes
コンパイル時間 2,006 ms
コンパイル使用メモリ 199,404 KB
最終ジャッジ日時 2025-01-14 19:20:45
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 48
権限があれば一括ダウンロードができます

ソースコード

diff #

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

struct h {
    size_t operator()(long k) const {
        __uint128_t n = k;
        return (n * 0x123456789abcdef) >> 64;
    }
};

int main() {
    int n, m;
    cin >> n >> m;
    unordered_map<long, int, h> a;
    for (int i = 0; i < n; i++) {
        long a_i;
        cin >> a_i;
        a[a_i]++;
    }
    for (int i = 0; i < m; i++) {
        long b;
        cin >> b;
        cout << a[b];
        if (i < m - 1) {
            cout << " ";
        } else {
            cout << endl;
        }
    }
}
0