結果

問題 No.206 数の積集合を求めるクエリ
ユーザー lumc_
提出日時 2018-03-21 19:26:56
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 1,029 ms / 7,000 ms
コード長 493 bytes
コンパイル時間 1,443 ms
コンパイル使用メモリ 159,616 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-24 19:39:11
合計ジャッジ時間 10,607 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
using ll = long long;

const int N = 1e5;
bitset<N> a, b;
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  int l, m, n; cin >> l >> m >> n;
  for(int i = 0; i < l; i++) {
    int x = 0; cin >> x; x--;
    a[x] = 1;
  }
  for(int i = 0; i < m; i++) {
    int x = 0; cin >> x; x--;
    b[x] = 1;
  }
  int q; cin >> q;
  cout << (a & b).count() << endl;
  for(int i = 1; i < q; i++) {
    b <<= 1;
    cout << (a & b).count() << endl;
  }
}
0