# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
272894 | doowey | Arcade (NOI20_arcade) | C++14 | 222 ms | 16748 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;
typedef pair<int, int> pii;
#define fi first
#define se second
#define mp make_pair
#define fastIO ios::sync_with_stdio(false);cin.tie(0);cout.tie(0);
int main(){
fastIO;
int n, m;
cin >> n >> m;
int x[m], y[m];
for(int i = 0 ; i < m ; i ++ )cin >> y[i];
for(int i = 0 ; i < m ; i ++ )cin >> x[i];
vector<pii> sh;
for(int i = 0 ; i < m; i ++ ){
sh.push_back(mp(x[i] + y[i], y[i] - x[i]));
}
sort(sh.begin(), sh.end());
vector<int> ans;
int id;
for(int i = m - 1; i >= 0 ; i -- ){
id = lower_bound(ans.begin(), ans.end(), sh[i].se) - ans.begin();
if(id == ans.size())
ans.push_back(sh[i].se);
else
ans[id] = sh[i].se;
}
cout << ans.size() << "\n";
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... |