結果

問題 No.206 数の積集合を求めるクエリ
ユーザー tnakao0123tnakao0123
提出日時 2016-04-12 13:27:59
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 968 ms / 7,000 ms
コード長 1,018 bytes
コンパイル時間 670 ms
コンパイル使用メモリ 88,184 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-15 00:40:46
合計ジャッジ時間 9,008 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,940 KB
testcase_03 AC 2 ms
6,944 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 2 ms
6,944 KB
testcase_06 AC 2 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 3 ms
6,940 KB
testcase_09 AC 3 ms
6,940 KB
testcase_10 AC 2 ms
6,940 KB
testcase_11 AC 4 ms
6,944 KB
testcase_12 AC 34 ms
6,944 KB
testcase_13 AC 28 ms
6,940 KB
testcase_14 AC 34 ms
6,940 KB
testcase_15 AC 33 ms
6,940 KB
testcase_16 AC 33 ms
6,944 KB
testcase_17 AC 55 ms
6,940 KB
testcase_18 AC 29 ms
6,944 KB
testcase_19 AC 50 ms
6,940 KB
testcase_20 AC 29 ms
6,940 KB
testcase_21 AC 35 ms
6,940 KB
testcase_22 AC 36 ms
6,940 KB
testcase_23 AC 52 ms
6,944 KB
testcase_24 AC 968 ms
6,944 KB
testcase_25 AC 963 ms
6,944 KB
testcase_26 AC 940 ms
6,940 KB
testcase_27 AC 707 ms
6,940 KB
testcase_28 AC 950 ms
6,940 KB
testcase_29 AC 952 ms
6,940 KB
testcase_30 AC 937 ms
6,944 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/* -*- coding: utf-8 -*-
 *
 * 206.cc: No.206 数の積集合を求めるクエリ - yukicoder
 */

#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<iostream>
#include<string>
#include<bitset>
#include<vector>
#include<map>
#include<set>
#include<stack>
#include<list>
#include<queue>
#include<deque>
#include<algorithm>
#include<numeric>
#include<utility>
#include<complex>
#include<functional>
 
using namespace std;

/* constant */

const int MAX_N = 100000;

/* typedef */

typedef unsigned int uint;

/* global variables */

/* subroutines */

/* main */

int main() {
  int l, m, n;
  cin >> l >> m >> n;

  bitset<MAX_N> abits(0), bbits(0);
  for (int i = 0; i < l; i++) {
    int ai;
    cin >> ai;
    ai--;
    abits.set(ai);
  }
  for (int i = 0; i < m; i++) {
    int bi;
    cin >> bi;
    bi--;
    bbits.set(bi);
  }

  int q;
  cin >> q;

  for (int i = 0; i < q; i++) {
    bitset<MAX_N> cbits = abits & (bbits << i);
    printf("%lu\n", cbits.count());
  }
  return 0;
}
0