150802025-02-12 12:38:51ercseferencDinamitcpp17Wrong answer 23/502ms512 KiB
#include <bits/stdc++.h>
using namespace std;
int main()
{
    //ifstream f("szamok.txt");
    int n,m,k; cin>>n>>m>>k;
    int a[n][m],ert[n][m];
    for(int i=0; i<n; i++){
        for(int j=0; j<m; j++){cin>>a[i][j];}}
    ert[0][0]=a[0][0];
    for(int i=1; i<m; i++){ert[0][i]=ert[0][i-1]+a[0][i];}
    for(int i=1; i<n; i++){ert[i][0]=ert[i-1][0]+a[i][0];}
    for(int i=1; i<n; i++){
        for(int j=i; j<m; j++)
            {ert[i][j]=a[i][j]+min(ert[i-1][j],ert[i][j-1]);}
        for(int j=i; j<n; j++)
            {ert[j][i]=a[j][i]+min(ert[j-1][i],ert[j][i-1]);}}
    vector<int>ut; int i=n-1,j=m-1; bool van=1;
    while(van){
        ut.push_back(a[i][j]);
        if(i!=0 && j!=0){
            if(ert[i][j-1]>=ert[i-1][j])i--;
            else j--;}
        else if(i==0 && j!=0)j--;
        else if(j==0 && i!=0)i--;
        else van=0;}
    for(int i=0; i<k; i++){
        int maxi=0,maxind;
        for(int j=0; j<ut.size(); j++){if(maxi<ut[j])
            {maxi=ut[j]; maxind=j;}}
        ut[maxind]=ut[maxind]/2;}
    int s=0;
    for(int i=0; i<ut.size(); i++){s+=ut[i];}
    cout<<s;
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base23/50
1Accepted0/01ms316 KiB
2Wrong answer0/01ms508 KiB
3Accepted2/22ms316 KiB
4Accepted2/22ms508 KiB
5Accepted3/31ms316 KiB
6Accepted3/32ms316 KiB
7Accepted2/22ms316 KiB
8Accepted3/32ms316 KiB
9Wrong answer0/21ms316 KiB
10Accepted2/21ms316 KiB
11Accepted3/31ms316 KiB
12Wrong answer0/31ms320 KiB
13Wrong answer0/21ms316 KiB
14Accepted3/31ms316 KiB
15Wrong answer0/21ms500 KiB
16Wrong answer0/32ms512 KiB
17Wrong answer0/21ms316 KiB
18Wrong answer0/32ms316 KiB
19Wrong answer0/21ms316 KiB
20Wrong answer0/31ms316 KiB
21Wrong answer0/21ms316 KiB
22Wrong answer0/31ms508 KiB