結果

問題 No.2064 Smallest Sequence on Grid
ユーザー Manuel1024
提出日時 2023-09-11 05:53:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 493 bytes
コンパイル時間 576 ms
コンパイル使用メモリ 69,376 KB
実行使用メモリ 14,976 KB
最終ジャッジ日時 2024-06-28 20:08:33
合計ジャッジ時間 5,423 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
using namespace std;

int main(){
    int h, w; cin >> h >> w;
    vector<string> s(h);
    for(auto &it: s) cin >> it;

    string ans = "";
    int i = 0, j = 0;
    while(true){
        ans += s[i][j];
        if(i == h-1 && j == w-1) break;
        if(i+1 < h && j+1 < w){
            if(s[i+1][j] < s[i][j+1]) i++;
            else j++;
        }else if(i+1 < h) i++;
        else j++;
    }
    cout << ans << endl;
    return 0;
}
0