結果

問題 No.8016 unordered_mapなるたけ落とすマン
ユーザー pekempey
提出日時 2016-05-22 00:54:12
言語 C++11
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 583 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,087 ms
コンパイル使用メモリ 180,104 KB
実行使用メモリ 9,796 KB
最終ジャッジ日時 2026-04-23 23:40:40
合計ジャッジ時間 6,406 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 43 WA * 5
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

unsigned xor_shift(unsigned x) {
	static unsigned y = time(NULL);
	x ^= y; x ^= x << 13; x ^= x >> 7; x ^= x << 17;
	return x;
}

struct Hash {
	size_t operator()(const long long &x) const {
		return xor_shift(hash<long long>()(x));
	}
};

int main() {
	int n, m;
	cin >> n >> m;

	unordered_map<long long, int, Hash> mp;
	for (int i = 0; i < n; i++) {
		long long a;
		scanf("%lld", &a);
		mp[xor_shift(a)]++;
	}
	for (int i = 0; i < m; i++) {
		long long b;
		scanf("%lld", &b);
		printf("%d ", mp[xor_shift(b)]);
	}

	cout << endl;
}
0