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];
- int cnt[105];
- for(int i = 0; i < 105; i++) {
- cnt[i] = 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 answer = 0;
- for(int i = 0; i < n; i++) {
- int potrebno = k - a[i];
- if(potrebno < 0) {
- potrebno = 0;
- }
- for(int j = potrebno; j <= 100; j++) {
- answer += cnt[j];
- }
- }
- cout << answer << endl;
- return 0;
- }
- /*
- a[i] + b[j] >= k
- k - a[i]
- **/
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement