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>
#include <map>

using uint64 = std::uint64_t;

int main()
{
    std::ios_base::sync_with_stdio(false);
    int n, k, a;
    std::cin >> n >> k;
    int row = 1;
    int column = 0;
    int min_ = 2019;
    n = n * (n+1)/2;
    for(int i = 1; i <= n; i++){
        if(row * (row+1)/2 < i){
            row++;
            column = 0;
        }
        column++;
        std::cin >> a;
        if(a < min_){
            if((row - column +1) * column <= k)
                min_ = a;
        }
    }
    std::cout << min_ << std::endl;
    return 0;
}