Submission #27636998
Source Code Expand
#include<bits/stdc++.h>
int main(){
using namespace std;
int N;
cin >> N;
vector<int> h(N + 2);
for(int i = 0; i < N; ++i)cin >> h[i + 1];
int answer = 0;
for(int i = 0; i < N + 1; ++i)answer += abs(h[i + 1] - h[i]);
cout << answer / 2 << endl;
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Grand Garden |
| User | MMNMM |
| Language | C++ (GCC 9.2.1) |
| Score | 300 |
| Code Size | 290 Byte |
| Status | AC |
| Exec Time | 7 ms |
| Memory | 3576 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | s1.txt, s2.txt, s3.txt |
| All | 01.txt, 02.txt, 03.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 12.txt, 13.txt, 14.txt, 15.txt, 16.txt, s1.txt, s2.txt, s3.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 01.txt | AC | 7 ms | 3524 KiB |
| 02.txt | AC | 2 ms | 3520 KiB |
| 03.txt | AC | 2 ms | 3440 KiB |
| 04.txt | AC | 2 ms | 3492 KiB |
| 05.txt | AC | 2 ms | 3576 KiB |
| 06.txt | AC | 2 ms | 3456 KiB |
| 07.txt | AC | 2 ms | 3448 KiB |
| 08.txt | AC | 2 ms | 3416 KiB |
| 09.txt | AC | 4 ms | 3368 KiB |
| 10.txt | AC | 2 ms | 3528 KiB |
| 11.txt | AC | 2 ms | 3576 KiB |
| 12.txt | AC | 1 ms | 3416 KiB |
| 13.txt | AC | 2 ms | 3460 KiB |
| 14.txt | AC | 2 ms | 3496 KiB |
| 15.txt | AC | 2 ms | 3444 KiB |
| 16.txt | AC | 2 ms | 3500 KiB |
| s1.txt | AC | 3 ms | 3456 KiB |
| s2.txt | AC | 2 ms | 3412 KiB |
| s3.txt | AC | 2 ms | 3520 KiB |