Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <cstring>
- #include <algorithm>
- #include <map>
- using namespace std;
- typedef long long ll;
- int main()
- {
- int k, n;
- cin >> k >> n;
- int a[n], b[n];
- long long cnt_a[105], cnt_b[105];
- for(int i = 0; i < 105; i++) {
- cnt_a[i] = 0;
- cnt_b[i] = 0;
- }
- for(int i = 0; i < n; i++) {
- cin >> a[i];
- cnt_a[a[i]] += 1;
- }
- for(int j = 0; j < n; j++) {
- cin >> b[j];
- cnt_b[b[j]] += 1;
- }
- long long answer = 0;
- for(int i = 0; i <= 100; i++) {
- for(int j = 0; j <= 100; j++) {
- if(i + j >= k and cnt_a[i] > 0 and cnt_b[j] > 0) {
- answer += cnt_a[i] * cnt_b[j];
- }
- }
- }
- cout << answer << endl;
- return 0;
- }
- /*
- a[i] + b[j] >= k
- k - a[i]
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement