21842022-12-30 06:20:14bzsofiaDinamitcpp11Wrong answer 23/503ms4132 KiB
#include <iostream>
#include <queue>

using namespace std;

struct adat
{
    char irany;
    int num, sum;
};

priority_queue <long long> v;
long long i, n, j, m, bomb, osszeg, a;
adat x[41][41];

int main()
{
    cin>>n>>m>>bomb;

    for (i=1; i<=n; ++i)
    {
        for (j=1; j<=m; ++j)
        {
            cin>>x[i][j].num;

            if (i==1)
            {
                x[i][j].sum=x[i][j-1].sum+x[i][j].num;
                x[i][j].irany='B'; //balra
            }
            else if (j==1)
            {
                x[i][j].sum=x[i-1][j].sum+x[i][j].num;
                x[i][j].irany='F'; //fel
            }
            else
            {
                x[i][j].sum=min(x[i-1][j].sum,x[i][j-1].sum)+x[i][j].num;
                if (x[i-1][j].sum<x[i][j-1].sum) x[i][j].irany='F';
                else x[i][j].irany='B';
            }
        }
    }

    i=n;
    j=m;
    while (x[i][j].sum>0)
    {
        v.push(x[i][j].num);

        if (x[i][j].irany=='B') --j;
        else --i;
    }

    for (i=1; i<=bomb; ++i)
    {
        a=v.top()/2;
        v.pop();
        v.push(a);
    }

    while (!v.empty())
    {
        osszeg+=v.top();
        v.pop();
    }

    cout<<osszeg;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base23/50
1Accepted0/03ms1904 KiB
2Wrong answer0/03ms2060 KiB
3Accepted2/23ms2224 KiB
4Accepted2/23ms2320 KiB
5Accepted3/33ms2520 KiB
6Accepted3/33ms2732 KiB
7Accepted2/23ms2896 KiB
8Accepted3/33ms3016 KiB
9Wrong answer0/22ms3208 KiB
10Accepted2/22ms3284 KiB
11Accepted3/32ms3412 KiB
12Wrong answer0/32ms3604 KiB
13Wrong answer0/22ms3756 KiB
14Accepted3/32ms3864 KiB
15Wrong answer0/23ms3868 KiB
16Wrong answer0/33ms3864 KiB
17Wrong answer0/23ms3968 KiB
18Wrong answer0/33ms3844 KiB
19Wrong answer0/23ms3836 KiB
20Wrong answer0/33ms3844 KiB
21Wrong answer0/23ms4076 KiB
22Wrong answer0/33ms4132 KiB