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

using namespace std;

vector<pair<int,long long> >tab;

int main()
{
    int n,m;
    scanf("%d%d",&n,&m);
    int k=n*(n+1)/2;
    int wsk=0;
    for(int i=1;i^(n+1);++i){
        for(int j=1;j^(i+1);++j){
            int in;
            long long num;
            scanf("%d",&in);
            num=j*(i+1-j);
            tab.push_back(make_pair(in,num));
            wsk++;
        }
    }
    sort(tab.begin(),tab.end());
    for(int i=0;i^k;++i){
        if(tab[i].second<=m){
            printf("%d",tab[i].first);
            break;
        }
    }
    return 0;
}