# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
256672 | Bruteforceman | Arcade (NOI20_arcade) | C++11 | 1082 ms | 2800 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;
const int maxn = 5e5 + 10;
struct data {
int idx;
int x, y;
bool operator < (data d) const {
return idx < d.idx;
}
};
int dp[maxn];
int a[maxn], t[maxn];
int main() {
int n, m;
scanf("%d %d", &n, &m);
for(int i = 0; i < m; i++) {
scanf("%d", &t[i]);
}
for(int i = 0; i < m; i++) {
scanf("%d", &a[i]);
}
vector <data> v;
for(int i = 0; i < m; i++) {
data d;
d.idx = a[i];
d.x = a[i] + t[i];
d.y = a[i] - t[i];
v.push_back(d);
}
sort(v.begin(), v.end());
int ans = 0;
for(int i = 0; i < m; i++) {
dp[i] = 1;
for(int j = 0; j < i; j++) {
if(v[j].idx < v[i].idx && v[j].x < v[i].x && v[j].y < v[i].y) {
dp[i] = max(dp[i], 1 + dp[j]);
}
}
ans = max(ans, dp[i]);
}
printf("%d\n", ans);
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... |