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

using namespace std;

int main() {
   ios_base::sync_with_stdio(0);
   int n, k;
   cin >> n >> k;
   int a, mn = 3000;
   for (int r = 1; r <= n; r++) {
      for (int c = 1; c <= r; c++) {
         cin >> a;
         int d = c * (r - c + 1);
         if (d <= k && mn > a) {
            mn = a;
         }
      }
   }
   cout << mn;
}