# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
864350 | ElenaBM | Pohlepko (COCI16_pohlepko) | C++17 | 77 ms | 65536 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main()
{
/* hacer una dp bidimensional en la que se pondra la solucion lexicograficamente menor en cada casilla*/
int x, y;
cin>> x >> y;
vector<vector<char>> tab(x, vector<char>(y));
vector<vector<string>> dp (x, vector<string>(y));
for (int i = 0; i < x; ++i){
for (int j = 0; j < y; ++j){
cin>> tab[i][j];
}
}
dp[0][0] = tab[0][0];
for (int i = 1; i < x; ++i)dp[i][0] = dp[i-1][0] + tab[i][0];
for (int j = 1; j < y; ++j)dp[0][j] = dp[0][j-1] + tab[0][j];
for (int i = 1; i < x; ++i){
for (int j = 1; j <y ; ++j){
dp[i][j] = min(dp[i-1][j], dp[i][j-1])+ tab[i][j];
}
}
cout<< dp[x-1][y-1] << '\n';
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |