結果
| 問題 |
No.2064 Smallest Sequence on Grid
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2022-09-02 22:35:08 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 822 bytes |
| コンパイル時間 | 1,698 ms |
| コンパイル使用メモリ | 170,948 KB |
| 実行使用メモリ | 12,544 KB |
| 最終ジャッジ日時 | 2024-11-16 04:43:56 |
| 合計ジャッジ時間 | 6,095 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 5 WA * 24 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
vector <string> listMatrix;
int H, W;
string str;
scanf("%d %d", &H, &W);
for (int i = 0; i < H; i++) {
cin >> str;
cin.ignore();
listMatrix.push_back(str);
}
int i = 0, j = 0;
string res = "";
res += listMatrix[0][0];
while (i < H - 1 || j < W - 1) {
if (i == H - 1) {
res += listMatrix[i][j + 1];
j++;
}
else if (j == W - 1) {
res += listMatrix[i + 1][j];
j++;
}
else if (listMatrix[i][j + 1] < listMatrix[i + 1][j]) {
res += listMatrix[i][j + 1];
j++;
}
else {
res += listMatrix[i + 1][j];
i++;
}
}
cout << res;
return 0;
}