結果

問題 No.206 数の積集合を求めるクエリ
ユーザー tails
提出日時 2015-05-08 23:26:29
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 5,127 ms / 7,000 ms
コード長 346 bytes
コンパイル時間 1,217 ms
コンパイル使用メモリ 157,692 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-05 20:39:34
合計ジャッジ時間 37,686 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int L,M,N,Q;
int A[100001],B[100001];
int main(){
	cin>>L>>M>>N;
	for(int i=0;i<L;++i){
		int x;
		cin>>x;
		A[x]=1;
	}
	for(int i=0;i<M;++i){
		int x;
		cin>>x;
		B[x]=1;
	}
	cin>>Q;
	for(int v=0;v<Q;++v){
		int r=0;
		for(int i=v;i<=N;++i){
			r+=A[i]*B[i-v];
		}
		cout<<r<<endl;
	}
	return 0;
}
0