結果

問題 No.8016 unordered_mapなるたけ落とすマン
ユーザー furafura
提出日時 2020-05-06 04:35:37
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 126 ms / 1,000 ms
コード長 317 bytes
コンパイル時間 2,420 ms
コンパイル使用メモリ 197,556 KB
最終ジャッジ日時 2025-01-10 07:09:30
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 48
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |         int n,m; scanf("%d%d",&n,&m);
      |                  ~~~~~^~~~~~~~~~~~~~
main.cpp:12:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |                 lint a; scanf("%lld",&a);
      |                         ~~~~~^~~~~~~~~~~
main.cpp:16:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   16 |                 lint b; scanf("%lld",&b);
      |                         ~~~~~^~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;
using lint=long long;

int main(){
	int n,m; scanf("%d%d",&n,&m);
	map<lint,int> f;
	rep(i,n){
		lint a; scanf("%lld",&a);
		++f[a];
	}
	rep(j,m){
		lint b; scanf("%lld",&b);
		printf("%d%c",f[b],j<m-1?' ':'\n');
	}
	return 0;
}
0