# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
864350 | ElenaBM | Pohlepko (COCI16_pohlepko) | C++17 | 77 ms | 65536 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |