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
#include <iostream>
using namespace std;

int main()
{
    int hight, k, allBootles, value;
    cin >> hight;
    cin >> k;
    allBootles = (hight * (hight + 1)) / 2;
	int limit = 0;
	int j = 0;
    int minimum = 2020;
    int localK;
    for (int i = 1; i <= allBootles; i++)
    {
        cin >> value;
        localK = (j + 1) * (limit - j + 1);
        if (value < minimum && localK <= k)
            minimum = value;
        if (j == limit)
        {
            j = 0;
            limit++;
        }
        else
        {
            j++;
        }
    }
    cout << minimum;
    return 0;
}