結果

問題 No.206 数の積集合を求めるクエリ
ユーザー bokusunny
提出日時 2022-04-01 23:01:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 237 ms / 7,000 ms
コード長 590 bytes
コンパイル時間 3,358 ms
コンパイル使用メモリ 223,404 KB
最終ジャッジ日時 2025-01-28 14:21:04
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define bokusunny ios::sync_with_stdio(false), cin.tie(nullptr);

#include <atcoder/convolution>
using namespace atcoder;

void solve() {
  int L, M, N;
  cin >> L >> M >> N;
  vector<long long> A(N + 1), B(N + 1);
  for (int i = 0; i < L; i++) {
    int a;
    cin >> a;
    A[a] = 1;
  }
  for (int i = 0; i < M; i++) {
    int b;
    cin >> b;
    B[N - b] = 1;
  }
  auto C = convolution_ll(A, B);
  int Q;
  cin >> Q;
  for (int v = 0; v < Q; v++) {
    cout << C[N + v] << endl;
  }
}

int main() {
  bokusunny;
  solve();

  return 0;
}
0