# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
850855 | dungz | Growing Vegetables is Fun 4 (JOI21_ho_t1) | C++17 | 2 ms | 4444 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.
//#pragma GCC optimize ("O2")
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
#define endl '\n'
#define task "task"
#define task "task"
#define prll pair<ll,ll>
#define pb push_back
#define ld long double
const ll MIN=-1e18,MAX=1e18,MOD=1e9+7,nmax=200005;
ll a[nmax],h1[nmax],h2[nmax],cost1[nmax],cost2[nmax];
int main(){
//freopen (task".inp", "r", stdin);
//freopen (task".out", "w", stdout);
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n;
cin>>n;
for(int i=1;i<=n;i++)
{
cin>>a[i];
}
h1[1]=a[1];
for(int i=2;i<=n;i++)
{
if(a[i]<=a[i-1])
{
cost1[i]=cost1[i-1]+a[i-1]-a[i]+1;
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |