127752024-12-30 11:40:08ercseferencSípálya (55 pont)cpp17Wrong answer 15/55500ms1268 KiB
#include <iostream>
using namespace std;
int main()
{
    int n,k; cin>>n>>k;
    int a[n],b[n-k]; for(int i=0; i<n; i++){cin>>a[i];}
    int maxert, maxind,s;
    for(int i=0; i<=n-k; i++){
        maxert=0; s=0;
        for(int j=i; j<i+k; j++){if(a[j]>maxert){maxert=a[j]; maxind=j;}}
        for(int j=i; j<i+k; j++){s=s+maxert+maxind-j-a[j];} b[i]=s;}
    int c=b[0];
    for(int i=0; i<=n-k; i++){if(b[i]<c)c=b[i];} cout<<c;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base15/55
1Accepted0/01ms320 KiB
2Accepted0/01ms320 KiB
3Accepted2/21ms320 KiB
4Accepted2/21ms320 KiB
5Accepted2/21ms388 KiB
6Accepted2/22ms320 KiB
7Wrong answer0/32ms320 KiB
8Wrong answer0/114ms460 KiB
9Wrong answer0/117ms472 KiB
10Wrong answer0/120ms468 KiB
11Accepted1/130ms544 KiB
12Accepted1/128ms460 KiB
13Accepted1/165ms444 KiB
14Accepted2/275ms428 KiB
15Accepted2/229ms472 KiB
16Time limit exceeded0/2500ms1184 KiB
17Time limit exceeded0/2500ms992 KiB
18Time limit exceeded0/2486ms1012 KiB
19Time limit exceeded0/3499ms1148 KiB
20Time limit exceeded0/2483ms1080 KiB
21Time limit exceeded0/2500ms1080 KiB
22Time limit exceeded0/2486ms1188 KiB
23Time limit exceeded0/2500ms1084 KiB
24Time limit exceeded0/2485ms1192 KiB
25Time limit exceeded0/2500ms1080 KiB
26Time limit exceeded0/2485ms1080 KiB
27Time limit exceeded0/2500ms1268 KiB
28Time limit exceeded0/3485ms1080 KiB
29Time limit exceeded0/3500ms1080 KiB
30Time limit exceeded0/3500ms1164 KiB