#include <bits/stdc++.h>
using namespace std;
#define REP(i, n) for (int i = 0; i < (int)n; i++)
#define ST first
#define ND second
#define MP make_pair
#define PB push_back
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef vector<PII> VPII;
typedef set<int> SI;
typedef long long LL;
#ifdef DEBUG
const bool debug = true;
#else
const bool debug = false;
#endif
int n, m, k, l, x;
const int inf = 1000 * 1000 * 1000;
const int MAKSN = 2 * 1000 + 13;
const LL MOD = 123456789LL;
int dist(int i, int j) {
int last_w_prawo = n - j + 1;
int ile_w_prawo = last_w_prawo - i + 1;
int ile_w_lewo = j;
return (ile_w_prawo * ile_w_lewo);
}
void readIn() {
int res = 20200;
cin >> n >> k;
for(int i = n; i >= 1; i--) {
for(int j = 1; j <= n - i + 1; j++) {
cin >> x;
if (dist(i, j) <= k) {
res = min(res, x);
}
}
}
cout << res << "\n";
}
void solve() {
}
int main() {
readIn();
solve();
return 0;
}
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 | #include <bits/stdc++.h> using namespace std; #define REP(i, n) for (int i = 0; i < (int)n; i++) #define ST first #define ND second #define MP make_pair #define PB push_back typedef vector<int> VI; typedef pair<int, int> PII; typedef vector<PII> VPII; typedef set<int> SI; typedef long long LL; #ifdef DEBUG const bool debug = true; #else const bool debug = false; #endif int n, m, k, l, x; const int inf = 1000 * 1000 * 1000; const int MAKSN = 2 * 1000 + 13; const LL MOD = 123456789LL; int dist(int i, int j) { int last_w_prawo = n - j + 1; int ile_w_prawo = last_w_prawo - i + 1; int ile_w_lewo = j; return (ile_w_prawo * ile_w_lewo); } void readIn() { int res = 20200; cin >> n >> k; for(int i = n; i >= 1; i--) { for(int j = 1; j <= n - i + 1; j++) { cin >> x; if (dist(i, j) <= k) { res = min(res, x); } } } cout << res << "\n"; } void solve() { } int main() { readIn(); solve(); return 0; } |
English