結果

問題 No.8016 unordered_mapなるたけ落とすマン
ユーザー zeosuttzeosutt
提出日時 2016-07-12 10:51:52
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 286 ms / 1,000 ms
コード長 464 bytes
コンパイル時間 596 ms
コンパイル使用メモリ 68,572 KB
実行使用メモリ 9,268 KB
最終ジャッジ日時 2024-10-14 14:19:42
合計ジャッジ時間 15,794 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 48
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <unordered_map>

using namespace std;

struct MyHash {
	// OpenJDK 7のhash()
	size_t operator()(long long val) const {
		val ^= (val >> 20) ^ (val >> 12);
		return val ^ (val >> 7) ^ (val >> 4);
	}
};

int main() {
	int n, m;
	unordered_map<long long, int, MyHash> 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