結果

問題 No.197 手品
ユーザー nohakai3nohakai3
提出日時 2022-11-17 12:58:47
言語 PyPy3
(7.3.8)
結果
WA  
実行時間 -
コード長 571 bytes
コンパイル時間 303 ms
使用メモリ 75,900 KB
最終ジャッジ日時 2023-03-25 20:16:07
合計ジャッジ時間 7,229 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 78 ms
75,768 KB
testcase_01 AC 78 ms
75,716 KB
testcase_02 AC 77 ms
75,632 KB
testcase_03 AC 77 ms
75,732 KB
testcase_04 WA -
testcase_05 AC 78 ms
75,380 KB
testcase_06 AC 77 ms
75,476 KB
testcase_07 AC 77 ms
75,772 KB
testcase_08 WA -
testcase_09 AC 76 ms
75,484 KB
testcase_10 AC 75 ms
75,384 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 74 ms
75,704 KB
testcase_18 AC 75 ms
75,780 KB
testcase_19 AC 73 ms
75,768 KB
testcase_20 AC 75 ms
75,740 KB
testcase_21 AC 84 ms
75,744 KB
testcase_22 AC 82 ms
75,692 KB
testcase_23 AC 75 ms
75,784 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 74 ms
75,572 KB
testcase_28 WA -
testcase_29 AC 72 ms
75,488 KB
testcase_30 AC 73 ms
75,548 KB
testcase_31 AC 76 ms
75,700 KB
testcase_32 AC 75 ms
75,480 KB
testcase_33 AC 77 ms
75,648 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 79 ms
75,488 KB
testcase_38 WA -
testcase_39 AC 78 ms
75,720 KB
testcase_40 AC 81 ms
75,424 KB
testcase_41 WA -
testcase_42 AC 79 ms
75,728 KB
testcase_43 AC 80 ms
75,480 KB
testcase_44 AC 81 ms
75,540 KB
testcase_45 AC 80 ms
75,672 KB
testcase_46 AC 75 ms
75,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
n=int(input())
T = input()
n_s = len(S)
n_t = len(T)
dp = [[float("inf")]*(n_t+1) for i in range(n_s+1)]
for i in range(n_s):
    dp[i][0] = i
for j in range(n_t):
    dp[0][j] = j
for i in range(n_s):
    for j in range(n_t):
        dp[i+1][j+1] = min(dp[i][j]+1,dp[i+1][j]+1,dp[i][j+1]+1)
        if S[i] == T[j]:
            dp[i+1][j+1] = min(dp[i][j],dp[i+1][j+1])

ans=dp[n_s][n_t]

if n<ans:
    print("SUCCESS")

else:
    if ans==0:
        print("FAILURE")
        exit()
    if n%ans==0:
        print("SUCCESS")
    else:
        print("FAILURE")
0