#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 x;
cin>> x;
for (int j = 0; j < y; ++j){
tab[i][j] = x[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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
604 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
4 ms |
8540 KB |
Output is correct |
6 |
Runtime error |
36 ms |
65536 KB |
Execution killed with signal 9 |
7 |
Runtime error |
54 ms |
65536 KB |
Execution killed with signal 9 |
8 |
Runtime error |
28 ms |
65536 KB |
Execution killed with signal 9 |
9 |
Correct |
2 ms |
1368 KB |
Output is correct |
10 |
Correct |
21 ms |
33372 KB |
Output is correct |
11 |
Runtime error |
31 ms |
65536 KB |
Execution killed with signal 9 |
12 |
Runtime error |
38 ms |
65536 KB |
Execution killed with signal 9 |
13 |
Runtime error |
35 ms |
65536 KB |
Execution killed with signal 9 |
14 |
Runtime error |
27 ms |
65536 KB |
Execution killed with signal 9 |
15 |
Correct |
3 ms |
4696 KB |
Output is correct |
16 |
Runtime error |
58 ms |
65536 KB |
Execution killed with signal 9 |