답안 #27027

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
27027 2017-07-09T03:56:26 Z top34051 Bulldozer (JOI17_bulldozer) C++14
0 / 100
2 ms 256 KB
#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) 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

bulldozer.cpp: In function 'bool cmp(node, node)':
bulldozer.cpp:11:21: warning: statement has no effect [-Wunused-value]
     if(x.x!=y.x) x.x<y.x;
                  ~~~^~~~
bulldozer.cpp: At global scope:
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);
                       ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -