Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- #ifdef _DEBUG
- freopen("input.txt", "r", stdin);
- // freopen("output.txt", "w", stdout);
- #endif
- int n;
- int A[n];
- int B[n];
- int C[n];
- long long ans=0;
- cin >> n;
- for(int i=0;i<n;i++)
- {
- cin >> A[i];
- }
- for(int i=0;i<n;i++)
- {
- cin >> B[i];
- C[i] = A[i]-B[i];
- }
- sort(C,C+n);
- for(int i=0;i<n;i++)
- {
- if(C[i] <=0) continue;
- int y =lower_bound(C, C+n, (1-C[i]))-C;
- ans+=i-y;
- }
- cout << ans << endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment