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

const int N=1000*2001;

int main() {
    int n,k,b;
    scanf("%d",&n);
    scanf("%d",&k);
    int totalb=(n*(n+1))/2;
    int row=1;
    int col=1;
    int limit=1;
    int m=2020;
    for(int i=0; i<totalb; ++i) {
        scanf("%d",&b);
        if( (row-col+1)*col <= k ) m=(m < b) ? m : b ;
        if(col==limit) {
            row++; col=1; limit++;
        }
        else col++;
    }
    printf("%d\n",m);

return 0;
}