| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 870668 | Marco_Escandon | Growing Vegetables is Fun 4 (JOI21_ho_t1) | C++11 | 1 ms | 348 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
ll n;
cin>>n;
ll cad[n];
ll ac[n];
ll ma=0;
for(int i=0; i<n; i++)
{
cin>>cad[i];
ac[i]=max(ma-cad[i],0LL);
ma=cad[i]+1;
if(i>0)
ac[i]+=ac[i-1];
}
ll bs=1e9+7;
ll sol=0;
ma=0;
for(int i=n-1; i>=0; i--)
{
sol+=max(ma-cad[i],0LL);
ma=cad[i]+1;
bs=min(bs,max(sol,ac[i]));
}
cout<<bs;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
