結果

問題 No.206 数の積集合を求めるクエリ
ユーザー konsin_tokage
提出日時 2018-03-22 20:34:19
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 515 bytes
コンパイル時間 1,494 ms
コンパイル使用メモリ 66,288 KB
実行使用メモリ 11,552 KB
最終ジャッジ日時 2024-06-24 20:23:20
合計ジャッジ時間 10,236 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21 TLE * 1 -- * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main(){
    int l, m, n, q;
    cin >> l >> m >> n;
    vector<int> a(l), b(m), c(n+1);
    for(int& i: a){
        cin >> i;
        c[i] = 1;
    }
    for(int& i: b)
        cin >> i;
    sort(b.begin(), b.end());
    cin >> q;
    vector<int> r(q);
    for(int i=0; i<q; ++i){
        for(int j=0; j<m&&b[j]+i<=n; ++j){
            r[i] += c[b[j]+i];
        }
    }
    for(int i: r)
        cout << i << endl;
    return 0;
}
0