# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
753290 | vjudge1 | Arcade (NOI20_arcade) | C++98 | 423 ms | 24448 KiB |
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;
typedef long long ll;
const ll maxn=5e5+7;
ll n, m, t[maxn], a[maxn];
vector <pair <ll, ll>> grid(maxn);
int main(){
cin >> n >> m;
for(int i=0; i<m; i++){
cin >> t[i];
}
for(int i=0; i<m; i++){
cin >> a[i];
}
for(int i=0; i<m; i++){
grid[i]=make_pair(a[i]+t[i], t[i]-a[i]);
}
sort(grid.rbegin(), grid.rend());
vector <ll> dp;
for (int i = 0; i < m; ++i){
ll idx = lower_bound(dp.begin(), dp.end(), grid[i].second)-dp.begin();
if(idx==dp.size()) dp.push_back(grid[i].second);
else dp[idx]=grid[i].second;
}
cout << dp.size() << endl;
return 0;
}
Compilation message (stderr)
# | 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... |