結果

問題 No.206 数の積集合を求めるクエリ
ユーザー masa
提出日時 2015-05-10 02:06:58
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 970 ms / 7,000 ms
コード長 592 bytes
コンパイル時間 516 ms
コンパイル使用メモリ 64,460 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-05 21:21:17
合計ジャッジ時間 8,602 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
#include <bitset>

using namespace std;

const unsigned int N_MAX = 100000;

int main() {
	int l, m, n, q;
	int input;

	cin >> l >> m >> n;
	bitset<N_MAX> a, b;

	for (int i = 0; i < l; i++) {
		cin >> input;
		a[input] = 1;
	}
	for (int i = 0; i < m; i++) {
		cin >> input;
		b[input] = 1;
	}
	cin >> q;

	vector<int> ans(q, 0);
	for (int i = 0; i < q; i++) {
		ans[i] = (a & b).count();
		a >>= 1;
	}

	for (int i = 0; i < q; i++) {
		cout << ans[i] << endl;
	}
	return 0;
}
0