結果

問題 No.8016 unordered_mapなるたけ落とすマン
ユーザー pekempey
提出日時 2016-05-22 01:03:50
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 53 ms / 1,000 ms
コード長 373 bytes
コンパイル時間 1,604 ms
コンパイル使用メモリ 164,728 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-10-07 05:59:01
合計ジャッジ時間 6,129 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 48
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:42: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
      |                                     ~~~~~^~~~~~~~~~~~~~~
main.cpp:14:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |                 scanf("%lld", &b);
      |                 ~~~~~^~~~~~~~~~~~

ソースコード

diff #

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

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

	vector<long long> a(n);
	for (int i = 0; i < n; i++) scanf("%lld", &a[i]);
	sort(a.begin(), a.end());

	for (int i = 0; i < m; i++) {
		long long b;
		scanf("%lld", &b);
		auto it = equal_range(a.begin(), a.end(), b);
		printf("%d ", (int)(it.second - it.first));
	}

	cout << endl;
}
0