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

using namespace std;
typedef long long int LI;

int W[2000][2000];

int solve(const LI& n, const LI& k)
{
    int year = W[0][0];
    for(LI i=1; i<n && i<k; ++i)
    {
        LI h = i>>1;
        LI cj = 0;
        for(LI j=0; j<=i; ++j)
        {   
            if (j <=h )
                cj = j;
            else 
                cj = i-j;

            if ((k >= ((cj+1)*i)) && (W[i][j] < year))
            {
                year = W[i][j];
            }
        }
    }
    return year;
}

int main()
{
    LI n, k;
    cin >> n >> k;
    for (LI i=0; i<n; ++i )
        for (LI j=0; j<=i; ++j)
        {
            cin >> W[i][j];
        }
    cout << solve(n,k);
    return 0;
}