Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <iostream>
- #include <math.h>
- #include <cmath>
- #include <string>
- using namespace std;
- int main()
- {
- long long k,j,m=0,a[10][11],n,i,s=0;
- cin>>n>>k;
- for (i=0; i<n; i++) {
- cin>>a[i][0];
- if (a[i][0]>m) m=a[i][0];
- for (j=1; j<=a[i][0]; j++) cin>>a[i][j];
- }
- for (j=1; j<m; j++)
- for (i=0; i<n; i++) if (j<=a[i][0]) {
- if (k>0 && a[i][j]>=s) {
- s+=a[i][j];
- k--;
- }
- }
- s+=k*50;
- cout<<s;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement