Submission #864353

#TimeUsernameProblemLanguageResultExecution timeMemory
864353ElenaBMPohlepko (COCI16_pohlepko)C++17
40 / 80
59 ms65536 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int x, y;
    cin>> x >> y;
    vector<vector<string>> tab(x, vector<string>(y));
    for (int i = 0; i < x; ++i){
        string o;
        cin>> o;
        for (int j = 0; j < y; ++j){
            tab[i][j] = o[j];
        }
    }
    for (int i = 1; i < x; ++i)tab[i][0] = tab[i-1][0] + tab[i][0];
    for (int j = 1; j < y; ++j)tab[0][j] = tab[0][j-1] + tab[0][j];
    for (int i = 1; i < x; ++i){
        for (int j = 1; j <y ; ++j){
            tab[i][j] = min(tab[i-1][j], tab[i][j-1])+ tab[i][j];
        }
    }
    cout<< tab[x-1][y-1] << '\n';
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...