236992026-01-27 17:57:19AkosVagyokEmborSípálya (55 pont)cpp17Wrong answer 0/55500ms2880 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 - 1; j >= i - k + 1; j--) {
            if (maxx <= t[j]) {
                maxx = t[j];
                index = j;
            }
        }
        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/01ms512 KiB
3Wrong answer0/21ms316 KiB
4Wrong answer0/22ms316 KiB
5Wrong answer0/22ms416 KiB
6Wrong answer0/22ms408 KiB
7Wrong answer0/32ms316 KiB
8Wrong answer0/113ms316 KiB
9Wrong answer0/114ms516 KiB
10Wrong answer0/117ms512 KiB
11Wrong answer0/124ms512 KiB
12Wrong answer0/123ms316 KiB
13Wrong answer0/150ms332 KiB
14Wrong answer0/257ms516 KiB
15Wrong answer0/224ms388 KiB
16Time limit exceeded0/2500ms2804 KiB
17Time limit exceeded0/2483ms2612 KiB
18Time limit exceeded0/2500ms2620 KiB
19Time limit exceeded0/3500ms2612 KiB
20Time limit exceeded0/2481ms2612 KiB
21Time limit exceeded0/2500ms2612 KiB
22Time limit exceeded0/2486ms2612 KiB
23Time limit exceeded0/2488ms2612 KiB
24Time limit exceeded0/2481ms2612 KiB
25Time limit exceeded0/2500ms2612 KiB
26Time limit exceeded0/2500ms2612 KiB
27Time limit exceeded0/2500ms2612 KiB
28Time limit exceeded0/3486ms2880 KiB
29Time limit exceeded0/3500ms2612 KiB
30Time limit exceeded0/3477ms2612 KiB