21832022-12-30 06:10:20bzsofiaDinamitcpp11Wrong answer 23/503ms4800 KiB
#include <iostream>
#include <queue>

using namespace std;

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

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

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

            if (i==1) sum[i][j]=sum[i][j-1]+num[i][j];
            else if (j==1) sum[i][j]=sum[i-1][j]+num[i][j];
            else sum[i][j]=min(sum[i-1][j],sum[i][j-1])+num[i][j];
        }
    }

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

        if (i==1 && j>1) --j;
        else if (j==1 && i>1) --i;
        else if (sum[i-1][j]<sum[i][j-1]) --i;
        else --j;
    }

    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/03ms1760 KiB
2Wrong answer0/03ms1940 KiB
3Accepted2/23ms2140 KiB
4Accepted2/23ms2348 KiB
5Accepted3/33ms2568 KiB
6Accepted3/33ms2776 KiB
7Accepted2/23ms2992 KiB
8Accepted3/33ms3176 KiB
9Wrong answer0/22ms3268 KiB
10Accepted2/22ms3484 KiB
11Accepted3/32ms3580 KiB
12Wrong answer0/32ms3788 KiB
13Wrong answer0/22ms3868 KiB
14Accepted3/32ms3996 KiB
15Wrong answer0/23ms4076 KiB
16Wrong answer0/33ms4180 KiB
17Wrong answer0/23ms4260 KiB
18Wrong answer0/33ms4352 KiB
19Wrong answer0/23ms4476 KiB
20Wrong answer0/33ms4676 KiB
21Wrong answer0/23ms4772 KiB
22Wrong answer0/33ms4800 KiB