結果
| 問題 | No.2064 Smallest Sequence on Grid |
| コンテスト | |
| ユーザー |
kyo1
|
| 提出日時 | 2022-09-02 21:44:26 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 776 bytes |
| 記録 | |
| コンパイル時間 | 1,344 ms |
| コンパイル使用メモリ | 218,508 KB |
| 実行使用メモリ | 723,356 KB |
| 最終ジャッジ日時 | 2026-06-27 11:31:32 |
| 合計ジャッジ時間 | 7,438 ms |
|
ジャッジサーバーID (参考情報) |
judge3_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 MLE * 1 -- * 19 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int H, W;
cin >> H >> W;
vector<string> S(H);
for (auto &&e : S) {
cin >> e;
}
string res = "";
res += S[0][0];
vector<pair<int, int>> X;
X.emplace_back(0, 0);
for (int i = 0; i < H + W - 2; i++) {
char c = 'z';
for (const auto &[y, x] : X) {
if (y + 1 < H && c > S[y + 1][x]) c = S[y + 1][x];
if (x + 1 < W && c > S[y][x + 1]) c = S[y][x + 1];
}
vector<pair<int, int>> Y;
for (const auto &[y, x] : X) {
if (y + 1 < H && c == S[y + 1][x]) Y.emplace_back(y + 1, x);
if (x + 1 < W && c == S[y][x + 1]) Y.emplace_back(y, x + 1);
}
res += c;
swap(X, Y);
}
cout << res << '\n';
return 0;
}
kyo1