Submission #732899

# Submission time Handle Problem Language Result Execution time Memory
732899 2023-04-29T11:40:37 Z wenqi Global Warming (NOI13_gw) C++17
0 / 40
184 ms 296 KB
#include <bits/stdc++.h>
using namespace std;
 
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 += min(1, h - p);
        }
        p = h;
    }
    printf("%lld", total);
}

Compilation message

gw.cpp: In function 'int main()':
gw.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    8 |     scanf("%d", &N);
      |     ~~~~~^~~~~~~~~~
gw.cpp:9:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
    9 |     scanf("%d", &p);
      |     ~~~~~^~~~~~~~~~
gw.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   12 |         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 8 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 21 ms 296 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 104 ms 276 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 184 ms 280 KB Output isn't correct
2 Halted 0 ms 0 KB -