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
37
38
39
40
41
#include <bits/stdc++.h>

using namespace std;

int przejdz(vector <vector <int> > v, int i) {
	int min = 2020;
	
	for (int j = 0; j < i+1; j++) 
		if (v[i][j] < min) min = v[i][j];
	return min;
}

int main() {

	int a, b;
	cin>>a>>b;
	int min = 2020;
	vector <vector <int> > v(a); 
	for (int i = 0; i < a; i++) {
		v[i] = vector <int>(i+1);
		for (int j = 0; j < i+1; j++) {
			cin>>v[i][j];
		}
	}
	
	int i = 0, w;
	
	while (b > 0) {
		
		w = przejdz(v, i);
		if (w < min) min = w;
		b -= i+1;
		i++;
		
	}
	
	cout<<min;


	return 0;
}