#include <bits/stdc++.h> using u32 = uint32_t; using u64 = uint64_t; using i32 = int32_t; using i64 = int64_t; int main() { std::ios_base::sync_with_stdio(0); u64 n; u64 k; std::cin >> n >> k; u64 ans = 2019; for(u64 i=1; i<=n; ++i) { for(u64 j=1; j<=i; ++j) { u64 x; std::cin >> x; if(x < ans) { u64 m = j * (i-j+1); if(m<=k) { ans = x; } } } } std::cout << ans << "\n"; 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 | #include <bits/stdc++.h> using u32 = uint32_t; using u64 = uint64_t; using i32 = int32_t; using i64 = int64_t; int main() { std::ios_base::sync_with_stdio(0); u64 n; u64 k; std::cin >> n >> k; u64 ans = 2019; for(u64 i=1; i<=n; ++i) { for(u64 j=1; j<=i; ++j) { u64 x; std::cin >> x; if(x < ans) { u64 m = j * (i-j+1); if(m<=k) { ans = x; } } } } std::cout << ans << "\n"; return 0; } |