1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <iostream>
using namespace std;

int main() {
	ios_base::sync_with_stdio(0);
	int n, k, a, minA = 5000;
	int i, j, krok, maksy;

	cin >> n >> k;
	for (i = 1; i <= n; i++) {
		krok = i - 2;
		maksy = i;
				for (j = 0; j < i; j++) {
					cin >> a;
					if(maksy <= k)
						minA = min(a, minA);
					maksy += krok;
					krok -= 2;
				}
	}
	cout << minA;
	return 0;
}