# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
732897 | wenqi | Global Warming (NOI13_gw) | C++17 | 0 ms | 0 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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);
}