237002026-01-27 17:59:15AkosVagyokEmborSípálya (55 pont)cpp17Wrong answer 0/55500ms2796 KiB
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
vector <int> t, aLenyeg, os;
int n, k;
void be() {
    cin >> n >> k;
    t.resize(n + 1);
    os.resize(n + 1);
    aLenyeg.resize(n + 1);
    for (int i = 1; i <= n; i++) {
        cin >> t[i];
        aLenyeg[i] = 0;
    }
}
void nagy() {
    for (int i = k; i <= n; i++) {
        int sum = 0;
        int maxx = t[i];
        int index = i;
        for (int j = i; j >= i - k + 1; j--) {
            sum += abs(maxx - t[j] - (j - index));
        }
        aLenyeg[i] = sum;
    }

}

int main()
{
    be();
    nagy();
    int maxx = t[k];
    cout << maxx;
}
SubtaskSumTestVerdictTimeMemory
base0/55
1Wrong answer0/01ms316 KiB
2Wrong answer0/01ms316 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/21ms316 KiB
5Wrong answer0/22ms316 KiB
6Wrong answer0/21ms316 KiB
7Wrong answer0/31ms316 KiB
8Wrong answer0/18ms512 KiB
9Wrong answer0/19ms512 KiB
10Wrong answer0/110ms316 KiB
11Wrong answer0/116ms528 KiB
12Wrong answer0/114ms516 KiB
13Wrong answer0/129ms516 KiB
14Wrong answer0/234ms316 KiB
15Wrong answer0/214ms520 KiB
16Time limit exceeded0/2500ms2612 KiB
17Time limit exceeded0/2488ms2628 KiB
18Time limit exceeded0/2500ms2612 KiB
19Time limit exceeded0/3500ms2628 KiB
20Time limit exceeded0/2485ms2612 KiB
21Time limit exceeded0/2500ms2612 KiB
22Time limit exceeded0/2500ms2796 KiB
23Time limit exceeded0/2500ms2612 KiB
24Time limit exceeded0/2483ms2620 KiB
25Time limit exceeded0/2500ms2612 KiB
26Time limit exceeded0/2499ms2616 KiB
27Time limit exceeded0/2500ms2612 KiB
28Time limit exceeded0/3481ms2612 KiB
29Time limit exceeded0/3500ms2616 KiB
30Time limit exceeded0/3499ms2612 KiB