結果
| 問題 |
No.206 数の積集合を求めるクエリ
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-05-09 01:17:24 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 651 bytes |
| コンパイル時間 | 426 ms |
| コンパイル使用メモリ | 64,564 KB |
| 実行使用メモリ | 10,780 KB |
| 最終ジャッジ日時 | 2024-07-05 20:57:24 |
| 合計ジャッジ時間 | 9,645 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 TLE * 1 -- * 6 |
ソースコード
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <utility>
#include <string>
using namespace std;
int main() {
int l, m, n, q;
int input;
cin >> l >> m >> n;
vector<bool> a(n + 1, false);
for (int i = 0; i < l; i++) {
cin >> input;
a[input] = true;
}
vector<int> b(m);
for (int i = 0; i < m; i++) {
cin >> b[i];
}
cin >> q;
vector<int> ans(q, 0);
int limit;
for (int i = 0; i < m; i++) {
limit = min(b[i] + q, (int) a.size());
for (int j = b[i]; j < limit; j++) {
if (a[j]) {
ans[j - b[i]]++;
}
}
}
for (int i = 0; i < q; i++) {
cout << ans[i] << endl;
}
return 0;
}