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 N = (int)2e3+7;
const long long INF = (long long)1e18+7;
struct Point {
int x, y, v;
};
int n;
Point a[N];
bool cmp(Point l, Point r) {
return l.x<r.x;
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for(int i = 1; i <= n; ++i) {
cin >> a[i].x >> a[i].y >> a[i].v;
}
sort(a+1, a+1+n, cmp);
long long ans = 0;
for(int i = 1; i <= n; ++i) {
long long cur = 0;
for(int j = i; j <= n; ++j) {
cur += a[j].v;
ans = max(ans, cur);
}
}
cout << ans << "\n";
return 0;
}
# | 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... |