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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#include <bits/stdc++.h>

#define F first
#define S second
#define pb push_back
#define ll long long
#define ld long double
#define vi vector<int>
#define vll vector<ll>
#define eb emplace_back
#define pll pair <ll, ll>
#define pii pair<int, int>
#define sz(x) int((x).size())
#define cd complex<long double>
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define vpii vector<pii>
#define sqr(x) ((x) * (x))
#define fenwick(x) ((x) & -(x))
#define debug(x) cout << "[ " << #x << " ]: " << (x) << endl;
#define FOR(a, b, c) for(int a = b; a < c; ++a)
#define we ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);

using namespace std;

const int MAX = 2000 + 12;
int tab[MAX][MAX];

int main()
{
    we

    int N, K; cin >> N >> K;
    
    for(int i = 1; i <= N; ++i)
    {
        for(int j = 1; j <= i; ++j)
        {
            cin >> tab[i][j];
        }
    }

    int res = tab[1][1];

    for(int i = 1; i <= N; ++i)
    {
        for(int j = 1; j <= i; ++j)
        {
            int a = min(i,  abs(1 - j)) + 1;
            int b = min(i - j, abs(1 - i)) + 1;
            if(a * b <= K)
            {
                res = min(res, tab[i][j]);
            } 
        }
    }

    cout << res << "\n";

    return 0;
}