結果

問題 No.3016 unordered_mapなるたけ落とすマン
ユーザー btkbtk
提出日時 2016-05-22 02:59:13
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 84 ms / 1,000 ms
コード長 1,420 bytes
コンパイル時間 1,864 ms
コンパイル使用メモリ 170,240 KB
実行使用メモリ 9,416 KB
最終ジャッジ日時 2024-04-19 12:45:51
合計ジャッジ時間 7,598 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 65 ms
9,284 KB
testcase_04 AC 75 ms
9,284 KB
testcase_05 AC 73 ms
9,280 KB
testcase_06 AC 84 ms
9,412 KB
testcase_07 AC 71 ms
9,284 KB
testcase_08 AC 70 ms
9,280 KB
testcase_09 AC 72 ms
9,160 KB
testcase_10 AC 72 ms
9,284 KB
testcase_11 AC 71 ms
9,412 KB
testcase_12 AC 74 ms
9,328 KB
testcase_13 AC 69 ms
9,284 KB
testcase_14 AC 74 ms
9,284 KB
testcase_15 AC 71 ms
9,284 KB
testcase_16 AC 69 ms
9,288 KB
testcase_17 AC 67 ms
9,412 KB
testcase_18 AC 66 ms
9,412 KB
testcase_19 AC 67 ms
9,280 KB
testcase_20 AC 73 ms
9,284 KB
testcase_21 AC 68 ms
9,412 KB
testcase_22 AC 71 ms
9,284 KB
testcase_23 AC 65 ms
9,412 KB
testcase_24 AC 66 ms
9,284 KB
testcase_25 AC 65 ms
9,284 KB
testcase_26 AC 65 ms
9,272 KB
testcase_27 AC 64 ms
9,280 KB
testcase_28 AC 63 ms
9,284 KB
testcase_29 AC 63 ms
9,160 KB
testcase_30 AC 63 ms
9,284 KB
testcase_31 AC 64 ms
9,284 KB
testcase_32 AC 66 ms
9,284 KB
testcase_33 AC 65 ms
9,408 KB
testcase_34 AC 62 ms
9,412 KB
testcase_35 AC 64 ms
9,152 KB
testcase_36 AC 67 ms
9,288 KB
testcase_37 AC 63 ms
9,412 KB
testcase_38 AC 58 ms
9,416 KB
testcase_39 AC 61 ms
9,156 KB
testcase_40 AC 60 ms
9,348 KB
testcase_41 AC 2 ms
5,376 KB
testcase_42 AC 2 ms
5,376 KB
testcase_43 AC 2 ms
5,376 KB
testcase_44 AC 6 ms
5,376 KB
testcase_45 AC 6 ms
5,376 KB
testcase_46 AC 6 ms
5,376 KB
testcase_47 AC 48 ms
6,832 KB
testcase_48 AC 52 ms
7,084 KB
testcase_49 AC 51 ms
7,092 KB
testcase_50 AC 44 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
struct INIT{INIT(){ios::sync_with_stdio(false);cin.tie(0);}}init;
namespace myhash{
    const int Bsizes[]={3,9,13,17,21,25,29,33,37,41,45,49,53,57,61,65,69,73,77,81};// num=20
    const int xor_nums[]={0x100007d1,0x5ff049c9,0x14560859,0x07087fef,0x3e277d49,0x4dba1f17,0x709c5988,0x05904258,0x1aa71872,0x238819b3,0x7b002bb7,0x1cf91302,0x0012290a,0x1083576b,0x76473e49,0x3d86295b,0x20536814,0x08634f4d,0x115405e8,0x0e6359f2};
    const int hash_key=xor_nums[rand()%20];
    template <typename T>
    struct myhash{
        inline std::size_t operator()(const T& val) const {
            return val^hash_key;
        }
    };
};
template <typename T>
class myhash_set:public std::unordered_set<T,myhash::myhash<T>> {
    using SET=std::unordered_set<T,myhash::myhash<T>>;
public:
    myhash_set():SET(){SET::rehash(myhash::Bsizes[rand()%20]);}
};
template <typename T,typename U>
class myhash_map:public std::unordered_map<T,U,myhash::myhash<T>> {
public:
    using MAP=unordered_map<T,U,myhash::myhash<T>>;
    myhash_map():MAP(){MAP::rehash(myhash::Bsizes[rand()%20]);}
};
typedef long long LL;

int main() {
    int N,M;
    cin >> N >> M;
    myhash_map<LL,int> cnt;
    for(int i = 0; i < N; i++){
        LL a;cin >> a;
        cnt[a]++;
    }
    for(int i = 0; i < M; i++){
        LL b;cin >> b;
        cout << (!i)+" " << cnt[b];
    }cout << endl;
    return 0;
}
0