#include <bits/stdc++.h> using namespace std; #define st first #define nd second #define pb push_back typedef long long ll; typedef double db; typedef long double ldb; typedef pair <int, int> pii; typedef pair <ll, ll> pll; typedef pair <ll, db> pdb; typedef pair <ldb, ldb> pldb; template <typename T> void Debug (T begin, T end); int si (); ll sl (); string ss (int); db sf (); ldb slf (); void pi (int, char = '\n'); void pl (ll, char = '\n'); void pf (db, char = '\n'); void plf (ldb, char = '\n'); void ps (string, char = '\n'); ll russian(ll, ll, ll); ll fastpow(ll, ll, ll); ll slowpow(ll, ll, ll); ll _gcd(ll, ll); ll _lcm(ll, ll); ll extgcd(ll, ll, ll&, ll&); ll _inv(ll, ll); const int INF = 1e9; const ll LINF = 1e18; int main() { int n = si(), k = si(); int res = INF; for (int i = 1; i <= n; ++i) for (int j = 1; j <= i; ++j) { int a = si(); if ((i - j + 1) * j <= k) res = min(res, a); } pi(res); return 0; } template <typename T> void Debug(T begin, T end) { printf("\nDEBUG:\n"); while (begin != end) printf("%d ", *begin), begin++; printf("\n\n"); } template <typename T> T scanf_t(string s) { T a; scanf(s.c_str(), &a); return a; } template <typename T> void printf_t(T a, string s, char end_l) { s.push_back(end_l); printf(s.c_str(), a); } int si() { return scanf_t<int>("%d"); } ll sl() { return scanf_t<ll>("%lld"); } db sf() { return scanf_t<db>("%f"); } ldb slf() { return scanf_t<ldb>("%Lf"); } void pi(int a, char end_l) { printf_t<int>(a, "%d", end_l); } void pl(ll a, char end_l) { printf_t<ll>(a, "%lld", end_l); } void pf(db a, char end_l) { printf_t<db>(a, "%lf", end_l); } void plf(ldb a, char end_l) { printf_t<ldb>(a, "%Lf", end_l); } void ps(string a, char end_l) { string s = "%s"; s.push_back(end_l); printf(s.c_str(), a.c_str()); } string ss(int NN) { char T[NN]; scanf("%s", T); return (string)T; } ll fastpow(ll a, ll k, ll m) { ll r = 1LL; while (k) { if (k & 1LL) r = (r * a) % m; a = (a * a) % m; k >>= 1LL; } return r; } ll slowpow(ll a, ll k, ll m) { ll r = 1LL; while (k) { if (k & 1LL) r = russian(r, a, m); a = russian(a, a, m); k >>= 1LL; } return r; } ll russian(ll a, ll k, ll m) { ll r = 0LL; while (k) { if (k & 1LL) r = (r + a) % m; a = (a + a) % m; k >>= 1LL; } return r; } ll _gcd(ll a, ll b) { while (b) swap(a %= b, b); return a; } ll _lcm(ll a, ll b) { return a / _gcd(a, b) * b; } ll extgcd(ll a, ll b, ll& k, ll& l) { if (b == 0) { k = 1; l = 0; return a; } ll res = extgcd(b, a % b, l, k); l -= a / b * k; return res; } ll _inv(ll a, ll p) { return fastpow(a, p - 2, p); }
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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | #include <bits/stdc++.h> using namespace std; #define st first #define nd second #define pb push_back typedef long long ll; typedef double db; typedef long double ldb; typedef pair <int, int> pii; typedef pair <ll, ll> pll; typedef pair <ll, db> pdb; typedef pair <ldb, ldb> pldb; template <typename T> void Debug (T begin, T end); int si (); ll sl (); string ss (int); db sf (); ldb slf (); void pi (int, char = '\n'); void pl (ll, char = '\n'); void pf (db, char = '\n'); void plf (ldb, char = '\n'); void ps (string, char = '\n'); ll russian(ll, ll, ll); ll fastpow(ll, ll, ll); ll slowpow(ll, ll, ll); ll _gcd(ll, ll); ll _lcm(ll, ll); ll extgcd(ll, ll, ll&, ll&); ll _inv(ll, ll); const int INF = 1e9; const ll LINF = 1e18; int main() { int n = si(), k = si(); int res = INF; for (int i = 1; i <= n; ++i) for (int j = 1; j <= i; ++j) { int a = si(); if ((i - j + 1) * j <= k) res = min(res, a); } pi(res); return 0; } template <typename T> void Debug(T begin, T end) { printf("\nDEBUG:\n"); while (begin != end) printf("%d ", *begin), begin++; printf("\n\n"); } template <typename T> T scanf_t(string s) { T a; scanf(s.c_str(), &a); return a; } template <typename T> void printf_t(T a, string s, char end_l) { s.push_back(end_l); printf(s.c_str(), a); } int si() { return scanf_t<int>("%d"); } ll sl() { return scanf_t<ll>("%lld"); } db sf() { return scanf_t<db>("%f"); } ldb slf() { return scanf_t<ldb>("%Lf"); } void pi(int a, char end_l) { printf_t<int>(a, "%d", end_l); } void pl(ll a, char end_l) { printf_t<ll>(a, "%lld", end_l); } void pf(db a, char end_l) { printf_t<db>(a, "%lf", end_l); } void plf(ldb a, char end_l) { printf_t<ldb>(a, "%Lf", end_l); } void ps(string a, char end_l) { string s = "%s"; s.push_back(end_l); printf(s.c_str(), a.c_str()); } string ss(int NN) { char T[NN]; scanf("%s", T); return (string)T; } ll fastpow(ll a, ll k, ll m) { ll r = 1LL; while (k) { if (k & 1LL) r = (r * a) % m; a = (a * a) % m; k >>= 1LL; } return r; } ll slowpow(ll a, ll k, ll m) { ll r = 1LL; while (k) { if (k & 1LL) r = russian(r, a, m); a = russian(a, a, m); k >>= 1LL; } return r; } ll russian(ll a, ll k, ll m) { ll r = 0LL; while (k) { if (k & 1LL) r = (r + a) % m; a = (a + a) % m; k >>= 1LL; } return r; } ll _gcd(ll a, ll b) { while (b) swap(a %= b, b); return a; } ll _lcm(ll a, ll b) { return a / _gcd(a, b) * b; } ll extgcd(ll a, ll b, ll& k, ll& l) { if (b == 0) { k = 1; l = 0; return a; } ll res = extgcd(b, a % b, l, k); l -= a / b * k; return res; } ll _inv(ll a, ll p) { return fastpow(a, p - 2, p); } |