#include <iostream>
#include <iomanip>
#include <vector>
#include <cmath>
#include <algorithm>
#include <set>
#include <queue>
#include <map>
#include <stack>
#include <bitset>
#include <string>
#include <cstring>
#include <iterator>
#include <random>
#define ll long long
#define ld long double
#define inf (ll)(2*1e18)
#define sort(a) sort(a.begin(), a.end())
#define reverse(a) reverse(a.begin(), a.end())
#define pb push_back
#define endl "\n"
using namespace std;
void solve(){
ll n, m, i, x, y;
cin>>n>>m;
vector<pair<ll, ll>> a(m);
for(i=0;i<m;++i){
cin>>x;
a[i] = {x, x};
}
for(i=0;i<m;++i){
cin>>y;
a[i] = {a[i].first - y, a[i].first + y};
}
sort(a);
reverse(a);
vector<ll> b;
for(i=0;i<m;++i){
x = lower_bound(b.begin(), b.end(), a[i].second) - b.begin();
if(x == b.size()){
b.pb(a[i].second);
}else{
b[x] = a[i].second;
}
}
cout<<b.size()<<endl;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
srand(time(nullptr));
ll t=1;
// cin>>t;
for(;t>0;--t){
solve();
}
return 0;
}
# | 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... |