結果

問題 No.8016 unordered_mapなるたけ落とすマン
ユーザー pekempey
提出日時 2016-05-22 00:47:46
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 337 bytes
コンパイル時間 1,424 ms
コンパイル使用メモリ 166,020 KB
実行使用メモリ 20,964 KB
最終ジャッジ日時 2024-10-07 05:43:45
合計ジャッジ時間 5,268 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 6 TLE * 1 -- * 41
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:12:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |                 scanf("%lld", &a);
      |                 ~~~~~^~~~~~~~~~~~
main.cpp:17:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   17 |                 scanf("%lld", &b);
      |                 ~~~~~^~~~~~~~~~~~

ソースコード

diff #

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

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

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

	cout << endl;
}
0