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
#include <iostream>
using namespace std;

int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int n, k;
  cin>>n>>k;
  int min = 2020;
  int wines[n][n];
  for (int i = 0; i < n; i++) {
    cin>>wines[i][0];
    if (i > k) break;
    else {
      if (wines[i][0] < min) min = wines[i][0];
    }
    for (int j = 1; j <= i; j++) {
      cin>>wines[i][j];
      if (wines[i][j] < min && (j+1)*(i-j+1) <= k) {
        min = wines[i][j];
      }
    }
  }
  cout<<min;
}