typedef long long ll; typedef long double ld; #include using namespace std; #define int long long signed main(){ ll h,w; std::cin >> h>>w; vector>> prev(h,vector>(w,{-1,-1})); vector s(h); for (int i = 0; i < h; i++) { std::cin >> s[i]; } vector>> kou(h+w+3); kou[0].insert({0,0}); string ans = ""; for (int i = 0; i < h+w-1; i++) { ll minc = 1000; for (auto e : kou[i]) { minc = min(minc, (ll)s[e.first][e.second]); } // std::cout << minc << std::endl; ans.push_back(minc); for (auto e : kou[i]) { if(s[e.first][e.second]==minc){ if(e.first+1