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
#include <cstdio>
#include <cmath>
#include <algorithm>

using namespace std;

int main() {
  int n, k;

  while(scanf("%d %d", &n, &k) == 2) {
    int result = 2020;

    for(int i=0; i<n; i++) {
      for(int j=0; j<=i; j++) {
        int a;
        int steps = (j + 1) * (i - j + 1);

        scanf("%d", &a);

        if (steps <= k) {
          result = min(a, result);
        }
      }
    }

    printf("%d\n", result);
  }
}