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
#include<bits/stdc++.h>
using namespace std;
unsigned int n,k,b,i,j,w;
inline unsigned int tro(unsigned int a)
{
	return a*(a+1)/2;
}
int main()
{
	w=99999999;
	scanf("%u%u",&n,&k);
	for(i=1;i<=n;++i)
	{
		for(j=1;j<=i;++j)
		{
			scanf("%u",&b);
			if(tro(i)-tro(j-1)-tro(i-j)<=k)
			{
				w=min(w,b);
			}
		}

	}
	printf("%u\n",w);

}