結果

問題 No.206 数の積集合を求めるクエリ
ユーザー sugim48sugim48
提出日時 2015-05-08 23:21:50
言語 C++11
(gcc 11.4.0)
結果
RE  
実行時間 -
コード長 1,199 bytes
コンパイル時間 691 ms
コンパイル使用メモリ 90,916 KB
実行使用メモリ 4,564 KB
最終ジャッジ日時 2023-09-19 08:48:15
合計ジャッジ時間 13,272 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#define _USE_MATH_DEFINES
#include <algorithm>
#include <cstdio>
#include <functional>
#include <iostream>
#include <cfloat>
#include <climits>
#include <cstring>
#include <cmath>
#include <fstream>
#include <map>
#include <queue>
#include <random>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <time.h>
#include <vector>
using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef pair<int, int> i_i;
typedef pair<ll, int> ll_i;
typedef pair<double, int> d_i;
typedef pair<ll, ll> ll_ll;
typedef pair<double, double> d_d;
struct edge { int v, w; };

ll MOD = 1000000007;
ll _MOD = 1000000009;
double EPS = 1e-10;

int main() {
	int L, M, N; cin >> L >> M >> N;
	int n = N / 32;
	vector<ull> a(n);
	while (L--) {
		int A; cin >> A;
		A--;
		a[A / 64] |= 1 << (A % 64);
	}
	vector<ull> b(n);
	while (M--) {
		int B; cin >> B;
		B--;
		b[B / 64] |= 1 << (B % 64);
	}
	int Q; cin >> Q;
	for (int v = 0; v < Q; v++) {
		int sum = 0;
		for (int i = 0; i < n; i++)
			sum += __builtin_popcountll(a[i] & b[i]);
		cout << sum << endl;
		int x = 0;
		for (int i = 0; i < n; i++) {
			int _x = b[i] >> 63;
			b[i] = (b[i] << 1) + x;
			x = _x;
		}
	}

}
0