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
29
30
31
32
33
34
35
36
#include<cstdio>

long long int depth(long long int r, long long int c) {
	return (c + 1) * (r - c + 1);
}

int main() {
	long long int n, k;
	long long int min = 3000;
	long long int wiek;

	scanf("%lld %lld", &n, &k);

	long long int r = 1;
	long long int c = 1;

	for (long long int i = 0; i < (n * (n + 1) / 2); i++) {
		scanf("%lld", &wiek);

		if (depth(r - 1, c - 1) <= k) {
			if (wiek < min) {
				min = wiek;
			}
		}

		c++;
		if (c > r) {
			r++;
			c = 1;
		}
	}

	printf("%lld", min);

	return 0;
}