結果

問題 No.206 数の積集合を求めるクエリ
ユーザー te-shte-sh
提出日時 2016-09-16 10:27:49
言語 D
(dmd 2.107.1)
結果
AC  
実行時間 1,701 ms / 7,000 ms
コード長 678 bytes
コンパイル時間 1,227 ms
コンパイル使用メモリ 114,796 KB
実行使用メモリ 24,632 KB
最終ジャッジ日時 2023-09-02 22:12:28
合計ジャッジ時間 15,296 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,368 KB
testcase_01 AC 1 ms
4,372 KB
testcase_02 AC 2 ms
4,368 KB
testcase_03 AC 1 ms
4,372 KB
testcase_04 AC 1 ms
4,368 KB
testcase_05 AC 1 ms
4,368 KB
testcase_06 AC 2 ms
4,368 KB
testcase_07 AC 2 ms
4,368 KB
testcase_08 AC 2 ms
4,368 KB
testcase_09 AC 2 ms
4,368 KB
testcase_10 AC 2 ms
4,368 KB
testcase_11 AC 2 ms
4,368 KB
testcase_12 AC 5 ms
4,372 KB
testcase_13 AC 5 ms
4,372 KB
testcase_14 AC 5 ms
4,372 KB
testcase_15 AC 5 ms
4,368 KB
testcase_16 AC 5 ms
4,368 KB
testcase_17 AC 30 ms
10,200 KB
testcase_18 AC 15 ms
6,036 KB
testcase_19 AC 27 ms
9,688 KB
testcase_20 AC 14 ms
5,536 KB
testcase_21 AC 20 ms
6,884 KB
testcase_22 AC 20 ms
6,768 KB
testcase_23 AC 27 ms
9,880 KB
testcase_24 AC 1,620 ms
24,632 KB
testcase_25 AC 1,701 ms
14,468 KB
testcase_26 AC 1,633 ms
14,048 KB
testcase_27 AC 1,120 ms
13,708 KB
testcase_28 AC 1,632 ms
13,824 KB
testcase_29 AC 1,628 ms
13,856 KB
testcase_30 AC 1,593 ms
14,196 KB
権限があれば一括ダウンロードができます

ソースコード

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