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 <cstdio>

int stepsRequired(int i, int j) {
	return (j+1)*(i-j+1);
}

int main() {
	int n, k;
	scanf("%d", &n);
	scanf("%d", &k);
	int prod;

	int oldest_wine = 9999;
	for(int i=0; i<n; i++) {
		for(int j=0; j<(i+1); j++) {
			scanf("%d", &prod);
			if(stepsRequired(i,j) <= k && prod < oldest_wine) {
				oldest_wine = prod;	
			}
		}
	}
	printf("%d\n", oldest_wine);
	return 0;
}