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
#include <iostream>
#include <string>
#include <algorithm>
#include <map>

using namespace std;

int main()
{
  int depth, req, min=2019, tmp_year;
  cin >> depth;
  cin >> req;

  for(int i=0; i<depth; i++)
  {
    for(int j=0; j<i+1; j++)
    {
      cin >> tmp_year;
      if( req >= (i-j+1)*(j+1) && tmp_year < min)
          min = tmp_year;
    }
  }
  cout << min << endl;

  return 0;
}