21822022-12-30 06:07:00bzsofiaDinamitcpp11Wrong answer 9/503ms3408 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 (sum[i-1][j]<sum[i][j-1] || 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
base9/50
1Accepted0/03ms1892 KiB
2Wrong answer0/03ms2132 KiB
3Accepted2/23ms2348 KiB
4Wrong answer0/23ms2504 KiB
5Wrong answer0/33ms2580 KiB
6Wrong answer0/33ms2712 KiB
7Accepted2/23ms2784 KiB
8Accepted3/33ms2912 KiB
9Wrong answer0/22ms2984 KiB
10Accepted2/22ms3244 KiB
11Wrong answer0/32ms3180 KiB
12Wrong answer0/32ms3280 KiB
13Wrong answer0/22ms3216 KiB
14Wrong answer0/32ms3068 KiB
15Wrong answer0/23ms3072 KiB
16Wrong answer0/33ms3200 KiB
17Wrong answer0/23ms3204 KiB
18Wrong answer0/33ms3204 KiB
19Wrong answer0/23ms3204 KiB
20Wrong answer0/33ms3332 KiB
21Wrong answer0/23ms3408 KiB
22Wrong answer0/33ms3408 KiB