Untitled

mail@pastecode.io avatar
unknown
c_cpp
3 years ago
612 B
0
Indexable
Never
#include <iostream>
#include <vector>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    int k, n;
    cin >> k >> n;
    int a[n], b[n];
    vector<int> cnt(105, 0);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    for(int j = 0; j < n; j++) {
        cin >> b[j];
        cnt[b[j]] += 1;
    }
    long long result = 0;
    for(int i = 0; i < n; i++) {
        int fali = k - a[i];
        if(fali < 0) {
            fali = 0;
        }
        for(int j = fali; j <= 100; j++) {
            result += cnt[j];
        }
    }
    cout << result << endl;
    return 0;
}