120912024-12-02 14:03:39szasztundeSípálya (55 pont)cpp11Wrong answer 2/5586ms2516 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/22ms320 KiB
4Wrong answer0/21ms424 KiB
5Wrong answer0/21ms320 KiB
6Wrong answer0/21ms428 KiB
7Wrong answer0/31ms420 KiB
8Wrong answer0/14ms428 KiB
9Wrong answer0/14ms508 KiB
10Wrong answer0/14ms484 KiB
11Wrong answer0/14ms484 KiB
12Wrong answer0/14ms428 KiB
13Wrong answer0/14ms400 KiB
14Wrong answer0/24ms320 KiB
15Wrong answer0/24ms424 KiB
16Accepted2/271ms2476 KiB
17Wrong answer0/271ms2488 KiB
18Wrong answer0/271ms2388 KiB
19Wrong answer0/371ms2444 KiB
20Wrong answer0/271ms2420 KiB
21Wrong answer0/271ms2360 KiB
22Wrong answer0/271ms2488 KiB
23Wrong answer0/271ms2360 KiB
24Wrong answer0/286ms2496 KiB
25Wrong answer0/271ms2360 KiB
26Wrong answer0/271ms2476 KiB
27Wrong answer0/271ms2396 KiB
28Wrong answer0/371ms2436 KiB
29Wrong answer0/371ms2360 KiB
30Wrong answer0/371ms2516 KiB