結果
| 問題 | No.206 数の積集合を求めるクエリ |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-02-27 22:21:51 |
| 言語 | D (dmd 2.112.0) |
| 結果 |
AC
|
| 実行時間 | 1,557 ms / 7,000 ms |
| コード長 | 584 bytes |
| 記録 | |
| コンパイル時間 | 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 |
ソースコード
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;
}
}