#include <bits/stdc++.h> #pragma GCC optimize ("-O3") #define io cin.sync_with_stdio(0);cin.tie(0); \ cin.exceptions(cin.failbit); using namespace std; using ll=long long; using pii=pair<int,int>;using vi=vector<int>; #define FOR(i,a,b) for(int i=a;i<=b;++i) #define ROF(i,a,b) for(int i=a;i>=b;--i) #define VEC(i,v) for(auto&i:v) #define I(x) ({x t;cin>>t;t;}) #define sz(x) int(x.size()) #define oo INT_MAX #define pf printf int main() { int c, x, y, b; int n = I(int), k = I(int); int val = +oo; FOR(lvl, 1, n) { // pf("lvl=%d\n", lvl); FOR(i, 1, lvl) { c = I(int); x = lvl - i + 1; y = lvl - (lvl - i); b = x*y; //pf("--> i=%d b=%d\n", i, b); if (b<=k) { val = min(val, c); } } } pf("%d\n", val); 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 | #include <bits/stdc++.h> #pragma GCC optimize ("-O3") #define io cin.sync_with_stdio(0);cin.tie(0); \ cin.exceptions(cin.failbit); using namespace std; using ll=long long; using pii=pair<int,int>;using vi=vector<int>; #define FOR(i,a,b) for(int i=a;i<=b;++i) #define ROF(i,a,b) for(int i=a;i>=b;--i) #define VEC(i,v) for(auto&i:v) #define I(x) ({x t;cin>>t;t;}) #define sz(x) int(x.size()) #define oo INT_MAX #define pf printf int main() { int c, x, y, b; int n = I(int), k = I(int); int val = +oo; FOR(lvl, 1, n) { // pf("lvl=%d\n", lvl); FOR(i, 1, lvl) { c = I(int); x = lvl - i + 1; y = lvl - (lvl - i); b = x*y; //pf("--> i=%d b=%d\n", i, b); if (b<=k) { val = min(val, c); } } } pf("%d\n", val); return 0; } |