8562022-01-21 07:42:32zsebiDinamitcpp11Wrong answer 23/502ms2248 KiB
#include <iostream>
//#include <fstream>
#include <algorithm>
#include <vector>

using namespace std;

//ifstream cin("dinamit.in");
//ofstream cout ("dinamit.out");
struct adat
{
    long long irany,k; //k=kenyelmetlenseg
};
adat x[101][101];
long long t[101][101],i,j,n,m,k,a,b,c,d,db,s,p,maxi;
vector<int>y;
int main()
{
    cin>>n>>m>>k;
    for(i=1;i<=n;++i)
    {
        for(j=1;j<=m;++j)
        {
            cin>>t[i][j];
        }
    }


   for(i=1;i<=n;++i)
    {
        for(j=1;j<=m;++j)
        {
            if(i==1)
            {
                x[i][j].irany=0;
                x[i][j].k=x[i][j-1].k+t[i][j];
            }
            else
                if(j==1)
                {
                    x[i][j].irany=1;
                    x[i][j].k=x[i-1][j].k+t[i][j];
                }
            else
            {
                c=t[i][j]+x[i][j-1].k;
                d=t[i][j]+x[i-1][j].k;
                if(c<d)
                {
                    x[i][j].k=c;
                    x[i][j].irany=0;
                }
                else
                {
                    x[i][j].k=d;
                    x[i][j].irany=1;
                }
            }
        }
    }

i=n;
j=m;
    while(i!=0 && j!=0)
    {
        y.push_back(t[i][j]);

        if(x[i][j].irany==0)j--;
        else i--;
    }
//----------------------------------------

    for(i=0;i<k;++i)
    {
        maxi=-1;
        p=0;
        for(j=0;j<y.size();++j)
            if(y[j]>maxi)
        {
            maxi=y[j];
            p=j;
        }
        y[p]=y[p]/2;
    }
    s=0;
    for(i=0;i<y.size();++i)
    {
        s+=y[i];
    }
    cout<<s;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base23/50
1Accepted0/02ms1924 KiB
2Wrong answer0/02ms2132 KiB
3Accepted2/22ms2056 KiB
4Accepted2/22ms2076 KiB
5Accepted3/32ms2092 KiB
6Accepted3/32ms2100 KiB
7Accepted2/22ms2244 KiB
8Accepted3/32ms2128 KiB
9Wrong answer0/21ms2076 KiB
10Accepted2/22ms2076 KiB
11Accepted3/31ms2084 KiB
12Wrong answer0/32ms2084 KiB
13Wrong answer0/21ms2108 KiB
14Accepted3/32ms2112 KiB
15Wrong answer0/22ms2168 KiB
16Wrong answer0/32ms2180 KiB
17Wrong answer0/22ms2196 KiB
18Wrong answer0/32ms2204 KiB
19Wrong answer0/22ms2212 KiB
20Wrong answer0/32ms2228 KiB
21Wrong answer0/22ms2244 KiB
22Wrong answer0/32ms2248 KiB