Submission #732897

#TimeUsernameProblemLanguageResultExecution timeMemory
732897wenqiGlobal Warming (NOI13_gw)C++17
Compilation error
0 ms0 KiB
#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 += min(1, h - p); } p = h; } printf("%lld", total); }

Compilation message (stderr)

gw.cpp: In function 'int main()':
gw.cpp:13:22: error: 'min' was not declared in this scope; did you mean 'main'?
   13 |             total += min(1, h - p);
      |                      ^~~
      |                      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);
      |         ~~~~~^~~~~~~~~~