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
#include <bits/stdc++.h>

using namespace std;
int n,k,wyn;
int wina[2011][2011];
int ile[2011][2011];

int getint(){
    int got;
    char c;
    c=getchar();
    got=int(c)-48;
    while(true){
        c=getchar();
        if(int(c)<48 || int(c)>57) break;
        got*=10;
        got+=int(c)-48;
    }
    return got;
}

int main(){
    n=getint();
    k=getint();
    wyn=100000000;
    for(int i=1; i<=n; i++){
        for(int j=1; j<=i; j++){
            wina[i][j]=getint();
            ile[i][j]=ile[i-1][j]+j;
            if(ile[i][j]<=k && wina[i][j]<wyn) wyn=wina[i][j];
        }
    }

    cout << wyn << endl;
}