#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
int32_t main () {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int N, M;
cin >> N >> M;
vector<array<int, 2>> arr(M);
for (int i = 0;i < M;i ++) {
cin >> arr[i][1];
}
for (int i = 0;i < M;i ++) {
cin >> arr[i][0];
}
sort (arr.begin(), arr.end());
vector<int> all;
for (int i = 0;i < M;i ++) {
bool as = false;
for (int j = 0;j < all.size();j ++) {
if (arr[i][0] - arr[all[j]][0] >= abs (arr[i][1] - arr[all[j]][1])) {
as = true;
arr[all[j]] = arr[i];
break;
}
}
if (as == false) {
all.push_back(i);
}
}
cout << all.size() << "\n";
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |