Submission #57919232
Source Code Expand
#include <bits/stdc++.h> using namespace std; using ll = long long; #define rep(i, x) for (int i = 0; i < (x); i++) int main() { string S, T; cin >> S >> T; vector<string> X; int N = (int)S.size(); while (S != T) { string next(N, 'z'); // 長さNで全てzの文字列を生成する。 for (int i = 0; i < N; i++) { if (S[i] != T[i]) { string tmpS = S; tmpS[i] = T[i]; // S_iだけT_iに変換した文字列を生成 next = min(next, tmpS); } } X.push_back(next); S = next; } cout << (int)X.size() << endl; for (auto s : X) { cout << s << endl; } return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Word Ladder |
User | ryoh1004 |
Language | C++ 23 (gcc 12.2) |
Score | 300 |
Code Size | 658 Byte |
Status | AC |
Exec Time | 4 ms |
Memory | 3652 KiB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample00.txt, sample01.txt, sample02.txt |
All | sample00.txt, sample01.txt, sample02.txt, testcase00.txt, testcase01.txt, testcase02.txt, testcase03.txt, testcase04.txt, testcase05.txt, testcase06.txt, testcase07.txt, testcase08.txt, testcase09.txt, testcase10.txt, testcase11.txt, testcase12.txt, testcase13.txt, testcase14.txt, testcase15.txt, testcase16.txt, testcase17.txt, testcase18.txt, testcase19.txt, testcase20.txt, testcase21.txt, testcase22.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample00.txt | AC | 1 ms | 3540 KiB |
sample01.txt | AC | 1 ms | 3476 KiB |
sample02.txt | AC | 1 ms | 3620 KiB |
testcase00.txt | AC | 1 ms | 3412 KiB |
testcase01.txt | AC | 1 ms | 3536 KiB |
testcase02.txt | AC | 1 ms | 3648 KiB |
testcase03.txt | AC | 1 ms | 3452 KiB |
testcase04.txt | AC | 1 ms | 3540 KiB |
testcase05.txt | AC | 1 ms | 3652 KiB |
testcase06.txt | AC | 1 ms | 3464 KiB |
testcase07.txt | AC | 1 ms | 3464 KiB |
testcase08.txt | AC | 1 ms | 3496 KiB |
testcase09.txt | AC | 1 ms | 3544 KiB |
testcase10.txt | AC | 1 ms | 3416 KiB |
testcase11.txt | AC | 1 ms | 3616 KiB |
testcase12.txt | AC | 1 ms | 3556 KiB |
testcase13.txt | AC | 4 ms | 3424 KiB |
testcase14.txt | AC | 1 ms | 3552 KiB |
testcase15.txt | AC | 1 ms | 3420 KiB |
testcase16.txt | AC | 1 ms | 3552 KiB |
testcase17.txt | AC | 1 ms | 3520 KiB |
testcase18.txt | AC | 1 ms | 3356 KiB |
testcase19.txt | AC | 1 ms | 3508 KiB |
testcase20.txt | AC | 1 ms | 3620 KiB |
testcase21.txt | AC | 1 ms | 3556 KiB |
testcase22.txt | AC | 1 ms | 3476 KiB |