Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- vector<int> maski(n);
- vector<int> cnt(95, 0);
- for(int i = 0; i < n; i++) {
- cin >> maski[i];
- cnt[maski[i]]++;
- }
- int m;
- cin >> m;
- vector<int> zenski(m);
- for(int i = 0; i < m; i++) {
- cin >> zenski[i];
- }
- sort(zenski.begin(), zenski.end());
- int R, k;
- cin >> R >> k;
- int res = 0;
- for(int i = 0; i + k - 1 < m; i++) {
- int najgolem = zenski[i] + R;
- int najmal = zenski[i + k - 1] - R;
- int kolku = 0;
- for(int j = max(30, najmal); j <= min(90, najgolem); j++) {
- kolku += cnt[j];
- }
- res = max(res, kolku);
- }
- cout << res << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement