結果

問題 No.206 数の積集合を求めるクエリ
ユーザー te-sh
提出日時 2016-09-16 10:27:49
言語 D
(dmd 2.109.1)
結果
AC  
実行時間 1,825 ms / 7,000 ms
コード長 678 bytes
コンパイル時間 1,094 ms
コンパイル使用メモリ 125,092 KB
実行使用メモリ 23,672 KB
最終ジャッジ日時 2024-06-12 04:26:01
合計ジャッジ時間 14,498 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

import std.algorithm, std.array, std.container, std.range, std.bitmanip;
import std.numeric, std.math, std.bigint, std.random, core.bitop;
import std.string, std.regex, std.conv, std.stdio, std.typecons;

void main()
{
  auto rd = readln.split.map!(to!size_t);
  auto l = rd[0], m = rd[1], n = rd[2];
  auto ai = readln.split.map!(to!int).array;
  auto bi = readln.split.map!(to!int).array;
  auto q = readln.chomp.to!int;

  auto ba = BitArray(new bool[](n));
  auto bb = BitArray(new bool[](n));

  foreach (a; ai) ba[a - 1] = true;
  foreach (b; bi) bb[b - 1] = true;

  foreach (i; 0..q) {
    writeln((cast(size_t[])(ba & bb)).map!(c => c.popcnt).sum);
    bb <<= 1;
  }
}
0