This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int n,m,t[500001],a[500001];
vector <pair <int, int>> p;
set <int> s;
int main(){
ios_base::sync_with_stdio(NULL);cin.tie(nullptr);
cin >> n >> m;
for (int i=1;i<=m;i++)
cin >> t[i];
for (int i=1;i<=m;i++){
cin >> a[i];
p.push_back({t[i]+a[i],t[i]-a[i]});
}
sort(p.begin(),p.end());
for (auto [i,j]:p){
auto it=s.lower_bound(-j);
if (it!=s.end())
s.erase(it);
s.insert(-j);
}
cout << s.size();
}
# | 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... |