結果

問題 No.206 数の積集合を求めるクエリ
コンテスト
ユーザー hogeover30
提出日時 2015-05-12 16:03:03
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 481 ms / 7,000 ms
+ 503µs
コード長 663 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 228 ms
コンパイル使用メモリ 64,768 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-08-08 18:31:38
合計ジャッジ時間 5,677 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <bitset>
using namespace std;

const int bufsize=8*100010;
char buf[bufsize];

int main()
{
    int L, M, N, Q;
    fgets(buf, bufsize, stdin);
    sscanf(buf, "%d%d%d", &L, &M, &N);

    bitset<100001> a;
    fgets(buf, bufsize, stdin);
    a.set(atoi(strtok(buf, " ")));
    for(int i=1;i<L;++i) a.set(atoi(strtok(NULL, " ")));

    bitset<100001> b;
    fgets(buf, bufsize, stdin);
    b.set(atoi(strtok(buf, " ")));
    for(int i=1;i<M;++i) b.set(atoi(strtok(NULL, " ")));

    Q=atoi(fgets(buf, bufsize, stdin));
    while (Q--) {
        printf("%d\n", (a&b).count());
        b<<=1;
    }
}
0