結果
| 問題 | 
                            No.206 数の積集合を求めるクエリ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2015-06-11 14:33:27 | 
| 言語 | C++11(廃止可能性あり)  (gcc 13.3.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 742 bytes | 
| コンパイル時間 | 335 ms | 
| コンパイル使用メモリ | 55,000 KB | 
| 実行使用メモリ | 5,376 KB | 
| 最終ジャッジ日時 | 2024-07-06 15:36:43 | 
| 合計ジャッジ時間 | 4,483 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 4 WA * 24 | 
ソースコード
#include <iostream>
#define REP(i,s,n) for(int i=(int)(s);i<(int)(n);i++)
using namespace std;
typedef long long int ll;
const int N = 100010;
const int S = 64;
const int M = (N + S - 1) / S;
int l, m, n;
ll a[M], b[M];
ll u[S][M];
int q;
int main(void){
  cin >> l >> m >> n;
  REP(i, 0, l) {
    int t;
    cin >> t;
    a[t / S] |= 1LL << (t % S);
  }
  REP(i, 0, m) {
    int t;
    cin >> t;
    b[t / S] |= 1LL << (t % S);
  }
  REP(i, 0, S) {
    u[i][0] = b[0] << i;
    REP(j, 1, M) {
      u[i][j] = b[j] << i | (i == 0 ? 0 : b[j - 1] >> (S - i));
    }
  }
  cin >> q;
  REP(v, 0, q) {
    int cnt = 0;
    REP(i, 0, M - v / S) {
      cnt += __builtin_popcount(a[i + v / S] & u[v % S][i]);
    }
    cout << cnt << endl;
  }
}