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 <iostream>
#include <vector>
#include <algorithm>
#define int int64_t
using namespace std;
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<pair<int,int>> ip(m);
for (int i = 0; i < m; i++) cin >> ip[i].first;
for (int i = 0; i < m; i++) cin >> ip[i].second;
for (int i = 0; i < m; i++) ip[i] = make_pair(ip[i].first + ip[i].second, ip[i].first - ip[i].second);
sort(ip.begin(), ip.end());
vector<int> ls(m + 1, (int)1e9);
for (int i = 0; i < m; i++)
{
int v = -ip[i].second;
*lower_bound(ls.begin(), ls.end(), v) = v;
}
cout << m + 1 - count(ls.begin(), ls.end(), (int)1e9) << "\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... |