Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- using namespace std;
- int main() {
- int k, n;
- cin >> k >> n;
- vector<int> a(n), b(n);
- vector<int> b1(101, 0), b2(101, 0);
- for(int i = 0; i < n; i++) {
- cin >> a[i];
- b1[a[i]]++;
- }
- for(int i = 0; i < n; i++) {
- cin >> b[i];
- b2[b[i]]++;
- }
- long long answer = 0;
- for(int i = 0; i <= 100; i++) {
- int kolku_fali = k - i;
- if(kolku_fali < 0) {
- kolku_fali = 0;
- }
- long long br = 0;
- for(int j = kolku_fali; j <= 100; j++) {
- br += b2[j];
- }
- answer += br * b1[i];
- }
- cout << answer << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement