結果

問題 No.206 数の積集合を求めるクエリ
ユーザー 👑 rin204
提出日時 2022-07-09 17:54:40
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 857 ms / 7,000 ms
コード長 595 bytes
コンパイル時間 1,965 ms
コンパイル使用メモリ 194,672 KB
最終ジャッジ日時 2025-01-30 05:58:49
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
//#include<atcoder/segtree>
using namespace std;
//using namespace atcoder;

void solve(){
    int l, m, n;
    cin >> l >> m >> n;
    bitset<100010> A, B;
    int a, b;
    for(int i = 0; i < l; i++){
        cin >> a;
        A[a] = 1;
    }
    for(int i = 0; i < m; i++){
        cin >> b;
        B[b] = 1;
    }
    int q;
    cin >> q;
    int ans;
    while(q--){
        ans = (A & B).count();
        cout << ans << "\n";
        B <<= 1;
    }
}

int main(){
    cin.tie(0)->sync_with_stdio(0);
    int t;
    t = 1;
    //cin >> t;
    while(t--) solve();
}
0