Submission #27029

#TimeUsernameProblemLanguageResultExecution timeMemory
27029top34051Bulldozer (JOI17_bulldozer)C++14
5 / 100
2 ms384 KiB
#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)

bulldozer.cpp:14:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
bulldozer.cpp: In function 'int main()':
bulldozer.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&n);
     ~~~~~^~~~~~~~~
bulldozer.cpp:18:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(i=1;i<=n;i++) scanf("%d%d%lld",&p[i].x,&p[i].y,&p[i].w);
                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...