結果

問題 No.206 数の積集合を求めるクエリ
ユーザー fine
提出日時 2017-03-11 21:49:57
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 970 ms / 7,000 ms
コード長 415 bytes
コンパイル時間 1,643 ms
コンパイル使用メモリ 168,804 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-24 13:40:58
合計ジャッジ時間 9,709 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
	cin.tie(0);
	ios::sync_with_stdio(false);
	int L, M, N;
	cin >> L >> M >> N;
	bitset<100000> a, b;
	for (int i = 0; i < L; i++) {
		int x;
		cin >> x;
		a.set(x - 1);
	}
	for (int i = 0; i < M; i++) {
		int x;
		cin >> x;
		b.set(x - 1);
	}
	int Q;
	cin >> Q;
	for (int i = 0; i < Q; i++) {
		cout << (a & b).count() << endl;
		b <<= 1;
	}
	return 0;
}
0