Submission #732896

# Submission time Handle Problem Language Result Execution time Memory
732896 2023-04-29T11:38:35 Z wenqi Global Warming (NOI13_gw) C++17
0 / 40
156 ms 9588 KB
#include <stdio.h>
 
int main() {
    int N, h, p;
    long long total;
    
    scanf("%d", &N);
    scanf("%d", &p);
    total = p;
    for (int i = 1; i < N; ++i) {
        scanf("%d", &h);
        if (h > p) {
            total += (h - p);
        }
        p = h;
    }
    printf("%lld", total);
}

Compilation message

gw.cpp: In function 'int main()':
gw.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    7 |     scanf("%d", &N);
      |     ~~~~~^~~~~~~~~~
gw.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d", &p);
      |     ~~~~~^~~~~~~~~~
gw.cpp:11:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   11 |         scanf("%d", &h);
      |         ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 9 ms 420 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 1032 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 142 ms 9588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 156 ms 8820 KB Output isn't correct
2 Halted 0 ms 0 KB -