結果
| 問題 |
No.206 数の積集合を求めるクエリ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-11 21:18:47 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 5,971 ms / 7,000 ms |
| コード長 | 573 bytes |
| コンパイル時間 | 1,747 ms |
| コンパイル使用メモリ | 171,600 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-24 13:30:26 |
| 合計ジャッジ時間 | 39,936 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 28 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(0);
ios::sync_with_stdio(false);
int L, M, N;
cin >> L >> M >> N;
vector<int> a(L), b(M);
for (int i = 0; i < L; i++) cin >> a[i];
for (int i = 0; i < M; i++) cin >> b[i];
int Q;
cin >> Q;
sort(a.begin(), a.end());
sort(b.begin(), b.end());
vector<int> cnt(Q, 0);
for (int i = 0; i < L; i++) {
for (int j = 0; j < M; j++) {
if (a[i] < b[j]) break;
if (a[i] >= b[j] + Q) continue;
cnt[a[i] - b[j]]++;
}
}
for (int i = 0; i < Q; i++) {
cout << cnt[i] << endl;
}
return 0;
}