120942024-12-02 14:20:23KissCsongor777Sípálya (55 pont)cpp11Wrong answer 2/5575ms1156 KiB
#include <iostream>

using namespace std;
int H[200001];
int main()
{
    int N,K,inf=999999,p=0,a,b,c;
    cin>>N>>K;
    //int H[N+1];//
    for(int i=1; i<=N; i++)cin>>H[i];
    for(int i=1; i<=N-2; i++)
    {
        p=0;
        a=H[i];b=H[i+1];c=H[i+2];
        if(c<b){p=p+b-c-1;c+=p;}
        else {p=p+(c-b+1);b=(c+1);}
        if(a<=b){p=p+(b-a+1);a=(b+1);}
        else while(a>b+1){b++; c++; p=p+2;}
        if(p<inf)inf=p;
    }
    cout<<inf;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base2/55
1Accepted0/01ms320 KiB
2Wrong answer0/01ms320 KiB
3Wrong answer0/21ms416 KiB
4Wrong answer0/21ms320 KiB
5Wrong answer0/21ms320 KiB
6Wrong answer0/21ms320 KiB
7Wrong answer0/31ms320 KiB
8Wrong answer0/14ms320 KiB
9Wrong answer0/14ms500 KiB
10Wrong answer0/14ms320 KiB
11Wrong answer0/14ms428 KiB
12Wrong answer0/14ms320 KiB
13Wrong answer0/14ms320 KiB
14Wrong answer0/24ms320 KiB
15Wrong answer0/24ms320 KiB
16Accepted2/274ms1032 KiB
17Wrong answer0/270ms1060 KiB
18Wrong answer0/270ms1028 KiB
19Wrong answer0/370ms940 KiB
20Wrong answer0/271ms1080 KiB
21Wrong answer0/270ms988 KiB
22Wrong answer0/270ms1108 KiB
23Wrong answer0/271ms1080 KiB
24Wrong answer0/275ms1080 KiB
25Wrong answer0/271ms1056 KiB
26Wrong answer0/271ms968 KiB
27Wrong answer0/275ms1080 KiB
28Wrong answer0/370ms1080 KiB
29Wrong answer0/370ms1156 KiB
30Wrong answer0/371ms1080 KiB