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
42
43
44
45
46
#include <iostream>
#include <limits.h>

using namespace std;

int main()
{

    int n,k;

    cin >> n >> k;

    int max_depth = k / 2 + 1;

    int* level_min = new int [max_depth + 1];

    for(int i = 0; i <= max_depth; i++)
    {
        level_min[i] = INT_MAX;
        
        for(int j = 0; j < i + 1; j++)
        {
            int temp;
            cin >> temp;

            
         if(i < max_depth ||( i == max_depth && ( j == 0 || j == i ) ))
            if(temp < level_min[i])
                level_min[i] = temp;
        }
    }



    int global_min = level_min[0];

    for(int i = 1; i < max_depth; i++)
        if(level_min[i] < global_min)
            global_min = level_min[i];

    cout << global_min; 



    return 0;
}