結果

問題 No.3016 unordered_mapなるたけ落とすマン
ユーザー zeosuttzeosutt
提出日時 2016-05-21 21:48:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 301 ms / 1,000 ms
コード長 1,512 bytes
コンパイル時間 743 ms
コンパイル使用メモリ 70,876 KB
実行使用メモリ 7,948 KB
最終ジャッジ日時 2024-04-16 11:27:49
合計ジャッジ時間 14,509 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 1 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 267 ms
7,812 KB
testcase_04 AC 284 ms
7,820 KB
testcase_05 AC 280 ms
7,816 KB
testcase_06 AC 278 ms
7,944 KB
testcase_07 AC 284 ms
7,816 KB
testcase_08 AC 279 ms
7,816 KB
testcase_09 AC 275 ms
7,812 KB
testcase_10 AC 277 ms
7,820 KB
testcase_11 AC 275 ms
7,816 KB
testcase_12 AC 274 ms
7,940 KB
testcase_13 AC 275 ms
7,944 KB
testcase_14 AC 276 ms
7,944 KB
testcase_15 AC 266 ms
7,816 KB
testcase_16 AC 270 ms
7,816 KB
testcase_17 AC 301 ms
7,764 KB
testcase_18 AC 268 ms
7,920 KB
testcase_19 AC 272 ms
7,812 KB
testcase_20 AC 267 ms
7,820 KB
testcase_21 AC 265 ms
7,940 KB
testcase_22 AC 277 ms
7,944 KB
testcase_23 AC 274 ms
7,816 KB
testcase_24 AC 256 ms
7,816 KB
testcase_25 AC 268 ms
7,944 KB
testcase_26 AC 260 ms
7,940 KB
testcase_27 AC 268 ms
7,948 KB
testcase_28 AC 264 ms
7,944 KB
testcase_29 AC 258 ms
7,816 KB
testcase_30 AC 255 ms
7,820 KB
testcase_31 AC 265 ms
7,940 KB
testcase_32 AC 254 ms
7,940 KB
testcase_33 AC 255 ms
7,820 KB
testcase_34 AC 257 ms
7,816 KB
testcase_35 AC 253 ms
7,816 KB
testcase_36 AC 245 ms
7,816 KB
testcase_37 AC 249 ms
7,816 KB
testcase_38 AC 252 ms
7,816 KB
testcase_39 AC 249 ms
7,812 KB
testcase_40 AC 244 ms
7,816 KB
testcase_41 AC 1 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 AC 2 ms
5,376 KB
testcase_44 AC 20 ms
5,376 KB
testcase_45 AC 18 ms
5,376 KB
testcase_46 AC 19 ms
5,376 KB
testcase_47 AC 210 ms
5,644 KB
testcase_48 AC 196 ms
5,896 KB
testcase_49 AC 208 ms
5,896 KB
testcase_50 AC 241 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <unordered_map>
#include <unordered_set>

using namespace std;

const int Bsizes[]={3,9,13,17,21,25,29,33,37,41,45,49,53,57,61,65,69,73,77,81};
const int xor_nums[]={0x100007d1,0x5ff049c9,0x14560859,0x07087fef,0x3e277d49,0x4dba1f17,0x709c5988,0x05904258,0x1aa71872,0x238819b3,0x7b002bb7,0x1cf91302,0x0012290a,0x1083576b,0x76473e49,0x3d86295b,0x20536814,0x08634f4d,0x115405e8,0x0e6359f2};
template <typename T>
class myhash_set:public std::unordered_set<T> {
private:
    int x;
public:
    inline T getorigin(T key){return key^x;};
    void insert(T key){std::unordered_set<T>::insert(key^x);}
    int count(T key){return std::unordered_set<T>::count(key^x);}
    myhash_set():std::unordered_set<T>(),x(xor_nums[rand()%20]){std::unordered_set<T>::rehash(Bsizes[rand()%20]);}
};
template <typename T,typename U>
class myhash_map:public std::unordered_map<T,U> {
private:
    int x;
public:
    inline T getorigin(T key){return key^x;};
    U& operator[](T key){return std::unordered_map<T,U>::operator[](key^x);}
    int count(T key){return std::unordered_map<T,U>::count(key^x);}
    myhash_map():std::unordered_map<T,U>(),x(xor_nums[rand()%20]){std::unordered_map<T,U>::rehash(Bsizes[rand()%20]);}
};

int main() {
    int n, m;
    myhash_map<long long, int> cnt;

    cin >> n >> m;
    while (n--) {
        long long a;
        cin >> a;
        cnt[a]++;
    }
    while (m--) {
        long long b;
        cin >> b;
        cout << cnt[b] << " \n"[!m];
    }

    return 0;
}
0