結果

問題 No.3016 unordered_mapなるたけ落とすマン
ユーザー kotatsugamekotatsugame
提出日時 2020-03-09 04:15:54
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 118 ms / 1,000 ms
コード長 618 bytes
コンパイル時間 832 ms
コンパイル使用メモリ 79,000 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2024-04-25 10:05:15
合計ジャッジ時間 8,794 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 95 ms
6,016 KB
testcase_04 AC 109 ms
6,016 KB
testcase_05 AC 111 ms
6,144 KB
testcase_06 AC 115 ms
5,888 KB
testcase_07 AC 115 ms
6,272 KB
testcase_08 AC 106 ms
6,016 KB
testcase_09 AC 105 ms
6,272 KB
testcase_10 AC 102 ms
6,144 KB
testcase_11 AC 102 ms
6,016 KB
testcase_12 AC 101 ms
6,144 KB
testcase_13 AC 105 ms
6,144 KB
testcase_14 AC 99 ms
6,144 KB
testcase_15 AC 100 ms
6,016 KB
testcase_16 AC 98 ms
6,144 KB
testcase_17 AC 97 ms
5,888 KB
testcase_18 AC 101 ms
6,272 KB
testcase_19 AC 94 ms
6,016 KB
testcase_20 AC 99 ms
6,016 KB
testcase_21 AC 96 ms
6,016 KB
testcase_22 AC 100 ms
6,016 KB
testcase_23 AC 94 ms
5,888 KB
testcase_24 AC 94 ms
6,144 KB
testcase_25 AC 93 ms
6,016 KB
testcase_26 AC 93 ms
6,016 KB
testcase_27 AC 87 ms
5,888 KB
testcase_28 AC 88 ms
6,016 KB
testcase_29 AC 90 ms
6,016 KB
testcase_30 AC 87 ms
6,016 KB
testcase_31 AC 90 ms
6,016 KB
testcase_32 AC 88 ms
5,888 KB
testcase_33 AC 85 ms
6,016 KB
testcase_34 AC 87 ms
6,144 KB
testcase_35 AC 90 ms
6,016 KB
testcase_36 AC 81 ms
6,144 KB
testcase_37 AC 84 ms
5,888 KB
testcase_38 AC 86 ms
6,016 KB
testcase_39 AC 82 ms
6,016 KB
testcase_40 AC 82 ms
6,144 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 9 ms
5,376 KB
testcase_45 AC 9 ms
5,376 KB
testcase_46 AC 9 ms
5,376 KB
testcase_47 AC 88 ms
5,376 KB
testcase_48 AC 90 ms
5,376 KB
testcase_49 AC 100 ms
5,376 KB
testcase_50 AC 118 ms
6,016 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:8:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    8 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int N,M;
long A[1<<17];
int ans[1<<17];
main()
{
	cin>>N>>M;
	for(int i=0;i<N;i++)cin>>A[i];
	sort(A,A+N);
	vector<pair<long,int> >B(M);
	for(int i=0;i<M;i++)
	{
		long b;cin>>b;
		B[i]=make_pair(b,i);
	}
	sort(B.begin(),B.end());
	int ia=0;
	for(int i=0;i<M;i++)
	{
		if(i>0&&B[i-1].first==B[i].first)
		{
			ans[B[i].second]=ans[B[i-1].second];
		}
		else
		{
			while(ia<N&&A[ia]<B[i].first)ia++;
			while(ia<N&&A[ia]==B[i].first)
			{
				ans[B[i].second]++;
				ia++;
			}
		}
	}
	for(int i=0;i<M;i++)cout<<ans[i]<<(i+1==M?"\n":" ");
}
0