結果
問題 | No.206 数の積集合を求めるクエリ |
ユーザー |
|
提出日時 | 2023-06-15 01:01:59 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 1,734 ms / 7,000 ms |
コード長 | 734 bytes |
コンパイル時間 | 3,073 ms |
コンパイル使用メモリ | 247,096 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-23 05:30:12 |
合計ジャッジ時間 | 16,741 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 28 |
ソースコード
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "debug.hpp" #else #define debug(...) 1 #endif const int mxN = 100005 * 2; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int L, M, N; cin >> L >> M >> N; vector<int> A(L), B(M); for (int i = 0; i < L; i++) { cin >> A[i]; A[i]--; } for (int i = 0; i < M; i++) { cin >> B[i]; B[i]--; } bitset<mxN> X, Y; for (int i = 0; i < L; i++) { X.set(A[i], 1); } for (int i = 0; i < M; i++) { Y.set(B[i], 1); } int Q; cin >> Q; for (int i = 0; i < Q; i++) { int ans = (X & Y).count(); cout << ans << '\n'; Y <<= 1; } }