//Krzysztof Boryczka #pragma GCC optimize "O3" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; const int inf=0x3f3f3f3f; const ll INF=0x3f3f3f3f3f3f3f3f; #define FOR(i, b, e) for(int i=b; i<=e; i++) #define FORD(i, b, e) for(int i=b; i>=e; i--) #define SIZE(x) ((int)x.size()) #define pb push_back #define st first #define nd second #define sp ' ' #define ent '\n' int n, k, a, ans; void solve(){ ans=inf; cin>>n>>k; FOR(i, 1, n) FOR(j, 1, i){ cin>>a; if(j*(i-j+1)<=k) ans=min(ans, a); } cout<<ans<<ent; } int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // int tt; cin>>tt; // FOR(te, 1, tt) 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 | //Krzysztof Boryczka #pragma GCC optimize "O3" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; typedef pair<int, int> ii; typedef vector<int> vi; typedef vector<ii> vii; const int inf=0x3f3f3f3f; const ll INF=0x3f3f3f3f3f3f3f3f; #define FOR(i, b, e) for(int i=b; i<=e; i++) #define FORD(i, b, e) for(int i=b; i>=e; i--) #define SIZE(x) ((int)x.size()) #define pb push_back #define st first #define nd second #define sp ' ' #define ent '\n' int n, k, a, ans; void solve(){ ans=inf; cin>>n>>k; FOR(i, 1, n) FOR(j, 1, i){ cin>>a; if(j*(i-j+1)<=k) ans=min(ans, a); } cout<<ans<<ent; } int main(){ ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); // int tt; cin>>tt; // FOR(te, 1, tt) solve(); return 0; } |