結果

問題 No.206 数の積集合を求めるクエリ
コンテスト
ユーザー ゴリポン先生
提出日時 2026-02-27 22:21:51
言語 D
(dmd 2.112.0)
コンパイル:
dmd -fPIE -m64 -w -wi -O -release -inline -I/opt/dmd/src/druntime/import/ -I/opt/dmd/src/phobos -L-L/opt/dmd/linux/lib64/ -fPIC _filename_
実行:
./Main
結果
AC  
実行時間 1,557 ms / 7,000 ms
コード長 584 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 3,937 ms
コンパイル使用メモリ 193,476 KB
実行使用メモリ 14,592 KB
最終ジャッジ日時 2026-02-27 22:22:08
合計ジャッジ時間 16,507 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

module main;
// https://yukicoder.me/problems/no/206/editorial より
// ビット演算
import std;

void main()
{
	// 入力
	int N, L, M;
	readln.chomp.formattedRead("%d %d %d", N, L, M);
	auto A = readln.split.to!(int[]);
	auto B = readln.split.to!(int[]);
	int Q = readln.chomp.to!int;
	// 答えの計算
	auto bufX = new bool[](100_001);
	foreach (a; A)
		bufX[a] = true;
	auto X = BitArray(bufX);
	auto bufY = new bool[](100_001);
	foreach (b; B)
		bufY[b] = true;
	auto Y = BitArray(bufY);
	// 答えの出力
	foreach (i; 0 .. Q) {
		writeln((X & Y).count);
		Y <<= 1;
	}
}
0