結果

問題 No.206 数の積集合を求めるクエリ
ユーザー codershifthcodershifth
提出日時 2016-01-16 17:07:17
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,056 bytes
コンパイル時間 1,244 ms
コンパイル使用メモリ 161,816 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 00:09:08
合計ジャッジ時間 5,371 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 3 ms
4,348 KB
testcase_12 AC 35 ms
4,348 KB
testcase_13 AC 30 ms
4,348 KB
testcase_14 AC 35 ms
4,348 KB
testcase_15 AC 34 ms
4,348 KB
testcase_16 AC 35 ms
4,348 KB
testcase_17 RE -
testcase_18 AC 12 ms
4,348 KB
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 AC 13 ms
4,348 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 1,036 ms
4,348 KB
testcase_29 RE -
testcase_30 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

typedef long long ll;
typedef unsigned long long ull;

#define FOR(i,a,b) for(int (i)=(a);i<(b);i++)
#define REP(i,n) FOR(i,0,n)
#define RANGE(vec) (vec).begin(),(vec).end()

using namespace std;


class QueryOfNumberProductSet
{
public:
    void solve(void)
    {
            int L,M,N;
            cin>>L>>M>>N;

            bitset<100000> A;
            bitset<100000> B;

            REP(i,L)
            {
                int x;
                cin>>x;
                A.set(x);
            }
            REP(i,M)
            {
                int x;
                cin>>x;
                B.set(x);
            }

            int Q;
            cin>>Q;

            REP(v,Q)
            {
                // 加算によってビットが左にずれる
                cout<<(A & B<<v).count()<<endl;
            }
    }
};

#if 1
int main(int argc, char *argv[])
{
        ios::sync_with_stdio(false);
        auto obj = new QueryOfNumberProductSet();
        obj->solve();
        delete obj;
        return 0;
}
#endif
0