45492023-03-29 14:33:57EyusieDinamitcpp17Wrong answer 5/503ms3972 KiB
#include <iostream>
#include <bits/stdc++.h>

using namespace std;

int main()
{
        int sor, oszlop, din;
        cin >> sor >> oszlop >> din;
        vector<vector<int>> asd(sor, vector<int>(oszlop));
        for(int i = 0; i < sor; i++)
        {
            for(int j = 0; j < oszlop; j++)
            {
                cin >> asd[i][j];
            }
        }
        vector<vector<int>> ertek(sor+1, vector<int>(oszlop+1));
        for(int i = 0; i <= sor; i++)
        {
            ertek[oszlop][i] = 999999999;
        }
        for(int i = 0; i <= oszlop; i++)
        {
            ertek[i][sor] = 999999999;
        }

        int valt = oszlop-2;
        ertek[sor-1][oszlop-1] = asd[sor-1][oszlop-1];
        for(int i = sor-1; i >= 0; i--)
        {
            for(int j = valt; j >= 0; j--)
            {
                if(ertek[i][j+1] > ertek[i+1][j]) ertek[i][j] = asd[i][j] + ertek[i+1][j];
                else ertek[i][j] = asd[i][j] + ertek[i][j+1];
            }
            valt = oszlop-1;
        }
        vector<int> s;
        int x = sor-1;
        int y = oszlop-1;
        s.push_back(asd[x][y]);
        while(x != 0 || y != 0)
        {
            if(y == 0) x--;
            else if(x == 0) y--;
            else if(ertek[x][y-1] > ertek[x-1][y]) x--;
            else y--;
            s.push_back(asd[x][y]);
        }
        sort(s.begin(), s.end(), greater<>());
        while(din > 0)
        {
            s[0] = floor(s[0]/2);
            sort(s.begin(),s.end(), greater<>());
            din--;
        }
        int szam = 0;
        for(int i = 0; i < s.size(); i++)
        {

            szam+=s[i];
        }
        cout << szam;

}
SubtaskSumTestVerdictTimeMemory
base5/50
1Accepted0/03ms1684 KiB
2Wrong answer0/03ms1940 KiB
3Wrong answer0/23ms2152 KiB
4Wrong answer0/23ms2288 KiB
5Wrong answer0/33ms2496 KiB
6Wrong answer0/33ms2692 KiB
7Accepted2/23ms2904 KiB
8Accepted3/33ms2988 KiB
9Wrong answer0/23ms3100 KiB
10Wrong answer0/23ms3212 KiB
11Wrong answer0/33ms3344 KiB
12Wrong answer0/32ms3424 KiB
13Wrong answer0/23ms3440 KiB
14Wrong answer0/33ms3544 KiB
15Wrong answer0/23ms3572 KiB
16Wrong answer0/33ms3656 KiB
17Wrong answer0/23ms3656 KiB
18Wrong answer0/33ms3660 KiB
19Wrong answer0/23ms3660 KiB
20Wrong answer0/33ms3764 KiB
21Wrong answer0/23ms3908 KiB
22Wrong answer0/33ms3972 KiB