結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,380 KB
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,376 KB
testcase_09 AC 2 ms
4,376 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
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 33 ms
4,380 KB
testcase_23 AC 49 ms
4,380 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:59:23: warning: ‘x’ may be used uninitialized in this function [-Wmaybe-uninitialized]
    b[i] = (b[i] << 1) + x;
           ~~~~~~~~~~~~^~~

ソースコード

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 / 16 + 1;
	vector<ll> a(n);
	while (L--) {
		int A; cin >> A;
		A--;
		a[A / 32] |= 1 << (A % 32);
	}
	vector<ll> b(n);
	while (M--) {
		int B; cin >> B;
		B--;
		b[B / 32] |= 1 << (B % 32);
	}
	int Q; cin >> Q;
	for (int v = 0; v < Q; v++) {
		int sum = 0;
		for (int i = 0; i < n; i++)
			sum += __builtin_popcount(a[i] & b[i]);
		cout << sum << endl;
		int x;
		for (int i = 0; i + 1 < n; i++) {
			int _x = b[i] >> 31;
			b[i] = (b[i] << 1) + x;
			x = _x;
		}
	}

}
0