1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <iostream>
using namespace std;

int main() {
    int n = 0;
    int k = 0;
    int year = 0;
    int steps = 0;
    int minimum = 0;
    cin >> n;
    cin >> k;
    cin >> minimum;

    for (int i = 1; i < n; i++) {
        steps = 0;
        for (int j = 0; j < i + 1; j++) {
            cin >> year;
            steps += i + 1 - 2 * j;
            if (steps <= k) {
                if (year < minimum) {
                    minimum = year;
                }
            }
        }
    }
    cout << minimum;

    return 0;
}