結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 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 3 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 3 ms
4,348 KB
testcase_12 AC 37 ms
4,348 KB
testcase_13 AC 30 ms
4,348 KB
testcase_14 AC 36 ms
4,348 KB
testcase_15 AC 36 ms
4,348 KB
testcase_16 AC 36 ms
4,348 KB
testcase_17 AC 22 ms
4,348 KB
testcase_18 AC 11 ms
4,348 KB
testcase_19 AC 20 ms
4,348 KB
testcase_20 AC 12 ms
4,348 KB
testcase_21 AC 14 ms
4,348 KB
testcase_22 AC 15 ms
4,348 KB
testcase_23 AC 20 ms
4,348 KB
testcase_24 AC 1,036 ms
4,348 KB
testcase_25 AC 1,031 ms
4,348 KB
testcase_26 AC 1,028 ms
4,348 KB
testcase_27 AC 769 ms
4,348 KB
testcase_28 AC 1,034 ms
4,348 KB
testcase_29 AC 1,025 ms
4,348 KB
testcase_30 AC 1,022 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

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<100001> A;
            bitset<100001> 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