1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <bits/stdc++.h>

using namespace std;

int main(){
    int n,k;
    cin>>n>>k;

    int ans = INT_MAX;

    for(int row=0;row<n;row++){
        for(int col=0 ; col<row+1 ; col++){
            int year;
            cin>>year;

            int cost = (col+1)*(row-col+1);

            if(cost <= k)
                ans = min(year,ans);
        }
    }

    cout << ans << endl;
}