結果
問題 | No.225 文字列変更(medium) |
ユーザー | nanasili |
提出日時 | 2015-07-31 21:37:25 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 923 bytes |
コンパイル時間 | 583 ms |
コンパイル使用メモリ | 82,376 KB |
実行使用メモリ | 7,212 KB |
最終ジャッジ日時 | 2023-09-24 22:38:45 |
合計ジャッジ時間 | 1,799 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge15 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | WA | - |
testcase_02 | AC | 1 ms
4,376 KB |
testcase_03 | AC | 2 ms
4,380 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | WA | - |
testcase_13 | AC | 7 ms
7,212 KB |
testcase_14 | WA | - |
testcase_15 | AC | 7 ms
7,040 KB |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 6 ms
6,716 KB |
testcase_21 | AC | 6 ms
7,008 KB |
ソースコード
#include <algorithm> #include <vector> #include <cfloat> #include <string> #include <cmath> #include <set> #include <cstdlib> #include <map> #include <ctime> #include <iomanip> #include <functional> #include <deque> #include <iostream> #include <cstring> #include <queue> #include <cstdio> #include <stack> #include <climits> #include <sys/time.h> #include <cctype> using namespace std; typedef long long ll; int main() { int n, m; scanf("%d %d", &n, &m); char s[n+1], t[m+1]; scanf("%s", s); scanf("%s", t); int d[n+1][m+1]; memset(d, 0, sizeof(d)); for (int i = 0; i < n; i++) { d[i][0] = i; } for (int i = 0; i < m; i++) { d[0][i] = i; } for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { int c = s[i] != t[j]; d[i][j] = min(d[i-1][j]+1, min(d[i][j-1]+1, d[i-1][j-1]+c)); } } printf("%d\n", d[n][m]); }