# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
27029 | top34051 | Bulldozer (JOI17_bulldozer) | C++14 | 2 ms | 384 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;
#define maxn 2005
struct node {
int x,y;
long long w;
};
int n;
node p[maxn];
bool cmp(node x,node y) {
if(x.x!=y.x) return x.x<y.x;
return x.y<y.y;
}
main() {
int i;
long long now,ans;
scanf("%d",&n);
for(i=1;i<=n;i++) scanf("%d%d%lld",&p[i].x,&p[i].y,&p[i].w);
sort(&p[1],&p[n+1],cmp);
ans = now = 0;
for(i=1;i<=n;i++) {
now += p[i].w;
if(now<0) now = 0;
ans = max(ans,now);
}
printf("%lld",ans);
}
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... |