結果
| 問題 |
No.8016 unordered_mapなるたけ落とすマン
|
| ユーザー |
Lay_ec
|
| 提出日時 | 2016-05-22 00:34:53 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 148 ms / 1,000 ms |
| コード長 | 841 bytes |
| コンパイル時間 | 838 ms |
| コンパイル使用メモリ | 91,628 KB |
| 実行使用メモリ | 9,396 KB |
| 最終ジャッジ日時 | 2024-10-07 05:27:53 |
| 合計ジャッジ時間 | 7,307 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 48 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:42:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
42 | scanf("%lld",&a);
| ~~~~~^~~~~~~~~~~
main.cpp:47:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
47 | scanf("%lld",&a);
| ~~~~~^~~~~~~~~~~
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
#include <algorithm>
#include <cstdlib>
#include <ctime>
#include <cstdio>
#include <functional>
#include <set>
#include <sstream>
#include <cctype>
#include <stack>
#include <queue>
#include <cstring>
#include <map>
#include <unordered_map>
using namespace std;
const long long INF=1LL<<50LL;
const double PI=3.14159265358979323846264;
hash<long long> h_ll;
class myHash {
public:
size_t operator()(const int &x) const {
const long long mod=1e9+7;
return h_ll(x)^h_ll((x+1145141919)%mod);
}
};
int main(){
int n,m;
cin>>n>>m;
unordered_map<long long,int,myHash > cnt;
long long a;
for(int i=0;i<n;i++){
scanf("%lld",&a);
cnt[a]++;
}
for(int i=0;i<m;i++){
scanf("%lld",&a);
cout<<cnt[a]<<" ";
}
cout<<endl;
return 0;
}
Lay_ec