// Wina [B]
// Jakub Rożek
#include <bits/stdc++.h>
using namespace std;
int n,k,x,odp;
int t[2002][2002];
int main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>n>>k;
cin>>odp;
t[1][1]=1;
for(int i=2; i<=n; ++i)
{
for(int j=1; j<=i; ++j)
{
t[i][j]=t[i-1][j]-t[i-2][j-1]+t[i-1][j-1]+1;
cin>>x;
if(t[i][j]<=k) odp=min(odp,x);
}
}
cout<<odp;
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 | // Wina [B] // Jakub Rożek #include <bits/stdc++.h> using namespace std; int n,k,x,odp; int t[2002][2002]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); cin>>n>>k; cin>>odp; t[1][1]=1; for(int i=2; i<=n; ++i) { for(int j=1; j<=i; ++j) { t[i][j]=t[i-1][j]-t[i-2][j-1]+t[i-1][j-1]+1; cin>>x; if(t[i][j]<=k) odp=min(odp,x); } } cout<<odp; return 0; } |
English