結果

問題 No.3016 unordered_mapなるたけ落とすマン
ユーザー cielciel
提出日時 2016-05-22 15:12:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 66 ms / 1,000 ms
コード長 936 bytes
コンパイル時間 627 ms
コンパイル使用メモリ 57,088 KB
実行使用メモリ 9,520 KB
最終ジャッジ日時 2024-04-19 12:46:52
合計ジャッジ時間 5,362 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 63 ms
9,428 KB
testcase_04 AC 62 ms
9,260 KB
testcase_05 AC 64 ms
9,412 KB
testcase_06 AC 65 ms
9,388 KB
testcase_07 AC 66 ms
9,388 KB
testcase_08 AC 66 ms
9,516 KB
testcase_09 AC 66 ms
9,516 KB
testcase_10 AC 64 ms
9,512 KB
testcase_11 AC 61 ms
9,260 KB
testcase_12 AC 61 ms
9,260 KB
testcase_13 AC 61 ms
9,260 KB
testcase_14 AC 62 ms
9,520 KB
testcase_15 AC 63 ms
9,388 KB
testcase_16 AC 61 ms
9,516 KB
testcase_17 AC 61 ms
9,512 KB
testcase_18 AC 61 ms
9,260 KB
testcase_19 AC 64 ms
9,388 KB
testcase_20 AC 60 ms
9,516 KB
testcase_21 AC 60 ms
9,260 KB
testcase_22 AC 61 ms
9,384 KB
testcase_23 AC 62 ms
9,388 KB
testcase_24 AC 59 ms
9,516 KB
testcase_25 AC 58 ms
9,260 KB
testcase_26 AC 58 ms
9,388 KB
testcase_27 AC 59 ms
9,388 KB
testcase_28 AC 60 ms
9,512 KB
testcase_29 AC 57 ms
9,384 KB
testcase_30 AC 59 ms
9,516 KB
testcase_31 AC 64 ms
9,512 KB
testcase_32 AC 60 ms
9,392 KB
testcase_33 AC 59 ms
9,516 KB
testcase_34 AC 58 ms
9,412 KB
testcase_35 AC 58 ms
9,388 KB
testcase_36 AC 58 ms
9,516 KB
testcase_37 AC 60 ms
9,392 KB
testcase_38 AC 60 ms
9,256 KB
testcase_39 AC 59 ms
9,388 KB
testcase_40 AC 60 ms
9,284 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 7 ms
5,376 KB
testcase_45 AC 6 ms
5,376 KB
testcase_46 AC 6 ms
5,376 KB
testcase_47 AC 53 ms
6,944 KB
testcase_48 AC 48 ms
7,320 KB
testcase_49 AC 46 ms
7,200 KB
testcase_50 AC 41 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <unordered_map>
#include <cstdio>

//本実装はboostによる.
namespace std{
	template<typename T>
	inline void hash_combine(size_t& seed, T const& v){
		seed ^= hash<T>()(v) + 0x9e3779b9 + (seed<<6) + (seed>>2);
	}
	template<typename It>
	inline size_t hash_range(It first, It last){
		size_t seed=0;
		hash_range(seed,first,last);
		return seed;
	}
	template<typename It>
	inline void hash_range(size_t& seed, It first, It last){
		for(;first!=last;++first)hash_combine(seed, *first);
	}
	template<typename A,typename B>
	class hash<pair<A,B>>{
		public:
		size_t operator()(pair<A,B> const &p) const{
			size_t seed=0;
			hash_combine(seed,p.first);
			hash_combine(seed,p.second);
			return seed;
		}
	};
}

int main(){
	int N,M;
	long long x;
	std::unordered_map<std::pair<long long,int>,int>m;
	scanf("%d%d",&N,&M);
	for(;N--;)scanf("%lld",&x),m[{x,0}]++;
	for(;M--;)scanf("%lld",&x),printf(M?"%d ":"%d\n",m[{x,0}]);
}
0