#include <bits/stdc++.h>
#define int long long
#define f first
#define s second
using namespace std;
const int MAXN = 5*1e5+20;
int arr[MAXN], t[MAXN];
int32_t main()
{
ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int N,M; cin >> N >> M;
vector<pair<int,int>> vec;
for(int i = 0;i<M;++i) cin >> arr[i];
for(int i = 0;i<M;++i) cin >> t[i];
for(int i = 0;i<M;++i) vec.push_back({t[i]-arr[i],t[i]+arr[i]});
sort(vec.begin(),vec.end());
set<int> sums; sums.insert((1LL<<60));
for(int i = 0;i<M;++i){
auto it = sums.upper_bound(vec[i].s);
if(it != sums.begin()){
--it;
sums.erase(it);
sums.insert(vec[i].s);
}
else{
sums.insert(vec[i].s);
}
}
cout << sums.size()-1 << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
2396 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |