結果

問題 No.197 手品
ユーザー nohakai3nohakai3
提出日時 2022-11-17 12:58:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 571 bytes
コンパイル時間 168 ms
コンパイル使用メモリ 81,532 KB
実行使用メモリ 53,336 KB
最終ジャッジ日時 2023-10-19 05:17:57
合計ジャッジ時間 3,411 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
53,336 KB
testcase_01 AC 37 ms
53,336 KB
testcase_02 AC 37 ms
53,336 KB
testcase_03 AC 38 ms
53,336 KB
testcase_04 WA -
testcase_05 AC 37 ms
53,336 KB
testcase_06 AC 38 ms
53,336 KB
testcase_07 AC 37 ms
53,336 KB
testcase_08 WA -
testcase_09 AC 38 ms
53,336 KB
testcase_10 AC 37 ms
53,336 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 38 ms
53,336 KB
testcase_18 AC 39 ms
53,336 KB
testcase_19 AC 37 ms
53,336 KB
testcase_20 AC 38 ms
53,336 KB
testcase_21 AC 38 ms
53,336 KB
testcase_22 AC 39 ms
53,336 KB
testcase_23 AC 38 ms
53,336 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 38 ms
53,336 KB
testcase_28 WA -
testcase_29 AC 38 ms
53,336 KB
testcase_30 AC 39 ms
53,336 KB
testcase_31 AC 38 ms
53,336 KB
testcase_32 AC 38 ms
53,336 KB
testcase_33 AC 38 ms
53,336 KB
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 38 ms
53,336 KB
testcase_38 WA -
testcase_39 AC 38 ms
53,336 KB
testcase_40 AC 38 ms
53,336 KB
testcase_41 WA -
testcase_42 AC 38 ms
53,336 KB
testcase_43 AC 38 ms
53,336 KB
testcase_44 AC 38 ms
53,336 KB
testcase_45 AC 38 ms
53,336 KB
testcase_46 AC 38 ms
53,336 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