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 <cassert>
#include <iostream>
#include <limits>
#include <vector>

int main() {
    int n, x, depth, result = std::numeric_limits<int>::max();

    std::cin >> n >> depth;

    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= i; j++) {
            std::cin >> x;
            int d;
            if (j == 1 || j == i) {
                d = i;
            } else {
                d =  j *  (i - j + 1);
            }
            //std::cerr << "(" << d << "," << x << ")";
            if(d <= depth) {
                result = std::min(result, x);
            }
        }
        //std::cerr << std::endl;
    }

    std::cout << result << std::endl;
}