8492022-01-20 20:34:19zsebiDinamitcpp11Wrong answer 5/503ms2208 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;
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)
        {
           a=x[i-1][j].k+ abs(t[i-1][j]-t[i][j]);
           b=x[i][j-1].k + abs(t[i][j-1]-t[i][j]);
           x[i][j].k=min(a,b);
        }

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

        }

    }


    i=1;
    for(j=1;j<=m;++j)x[i][j].irany=0;
    j=1;
    for(i=1;i<=n;++i)x[i][j].irany=1;

    /*for(i=1;i<=n;++i)
    {
        for(j=1;j<=m;++j)
        {
            cout<<x[i][j].k<<' ';
        }
        cout<<"\n";
    }
    cout<<"\n";*/

   /*for(i=1;i<=n;++i)
    {
        for(j=1;j<=m;++j)
        {
           cout<<x[i][j].irany<<" ";
        }
        cout<<"\n";
    }*/
i=n;
j=m;
db=0;

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

        if(x[i][j].irany==0)j--;
        else i--;
        db++;
    }
    //sort(y.begin(), y.end());
    //for(i=0;i<y.size();++i)cout<<y[i]<<" ";
    for(i=0;i<k;++i)
    {
        sort(y.begin(), y.end());
        reverse(y.begin(), y.end());
        y[0]/=2;

    }
    for(i=0;i<y.size();++i)
    {
        s+=y[i];
    }
    cout<<s;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base5/50
1Accepted0/02ms1824 KiB
2Wrong answer0/02ms2076 KiB
3Wrong answer0/22ms2020 KiB
4Wrong answer0/22ms2028 KiB
5Wrong answer0/32ms2040 KiB
6Wrong answer0/32ms2056 KiB
7Accepted2/22ms2200 KiB
8Accepted3/33ms2080 KiB
9Wrong answer0/21ms2024 KiB
10Wrong answer0/21ms2032 KiB
11Wrong answer0/32ms2036 KiB
12Wrong answer0/31ms2040 KiB
13Wrong answer0/22ms2068 KiB
14Wrong answer0/31ms2068 KiB
15Wrong answer0/22ms2124 KiB
16Wrong answer0/32ms2132 KiB
17Wrong answer0/22ms2144 KiB
18Wrong answer0/33ms2164 KiB
19Wrong answer0/22ms2168 KiB
20Wrong answer0/32ms2184 KiB
21Wrong answer0/22ms2196 KiB
22Wrong answer0/33ms2208 KiB