Submission #660798

# Submission time Handle Problem Language Result Execution time Memory
660798 2022-11-23T08:50:44 Z roddarichard Growing Vegetables is Fun 4 (JOI21_ho_t1) C++17
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
int32_t main() {
  int n;
  cin >> n;
  int arr[n];
  for (int i = 0; i < n; ++i) {
    cin >> arr[i];
  }
  int diffarr[n];
  diffarr[0]=arr[0];
  for (int i = 1; i < n; i++){
    diffarr[i] = arr[i] - arr[i - 1];
  }
  int sum=0;
  for (int i=0;i<n;++i){
    if (diffarr[i]>0){
      sum+=diffarr[i];
    }
  }
  cout << sum;
}
# 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 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -