結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 RE -
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 8 ms
4,380 KB
testcase_13 AC 7 ms
4,380 KB
testcase_14 AC 8 ms
4,380 KB
testcase_15 AC 8 ms
4,376 KB
testcase_16 AC 8 ms
4,376 KB
testcase_17 AC 52 ms
4,376 KB
testcase_18 AC 27 ms
4,380 KB
testcase_19 AC 48 ms
4,376 KB
testcase_20 AC 27 ms
4,376 KB
testcase_21 AC 33 ms
4,376 KB
testcase_22 AC 34 ms
4,376 KB
testcase_23 AC 48 ms
4,376 KB
testcase_24 AC 1,519 ms
4,384 KB
testcase_25 AC 1,510 ms
4,376 KB
testcase_26 AC 1,500 ms
4,376 KB
testcase_27 AC 1,086 ms
4,380 KB
testcase_28 AC 1,498 ms
4,380 KB
testcase_29 AC 1,504 ms
4,376 KB
testcase_30 AC 1,489 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

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] |= 1ULL << (A % 64);
	}
	vector<ull> b(n);
	while (M--) {
		int B; cin >> B;
		B--;
		b[B / 64] |= 1ULL << (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