結果

問題 No.197 手品
ユーザー tnodinotnodino
提出日時 2022-07-22 19:50:00
言語 Python3
(3.11.6 + numpy 1.26.0 + scipy 1.11.3)
結果
WA  
実行時間 -
コード長 517 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 10,928 KB
実行使用メモリ 8,672 KB
最終ジャッジ日時 2023-09-17 06:42:45
合計ジャッジ時間 3,093 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 AC 18 ms
8,580 KB
testcase_04 AC 18 ms
8,456 KB
testcase_05 AC 18 ms
8,464 KB
testcase_06 AC 18 ms
8,460 KB
testcase_07 AC 18 ms
8,644 KB
testcase_08 AC 18 ms
8,512 KB
testcase_09 AC 18 ms
8,628 KB
testcase_10 AC 18 ms
8,464 KB
testcase_11 AC 18 ms
8,584 KB
testcase_12 WA -
testcase_13 AC 18 ms
8,468 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 18 ms
8,596 KB
testcase_24 AC 19 ms
8,520 KB
testcase_25 AC 19 ms
8,484 KB
testcase_26 AC 19 ms
8,616 KB
testcase_27 WA -
testcase_28 AC 18 ms
8,636 KB
testcase_29 WA -
testcase_30 AC 19 ms
8,644 KB
testcase_31 AC 18 ms
8,652 KB
testcase_32 AC 18 ms
8,444 KB
testcase_33 WA -
testcase_34 AC 18 ms
8,520 KB
testcase_35 AC 18 ms
8,464 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 18 ms
8,636 KB
testcase_39 WA -
testcase_40 AC 18 ms
8,516 KB
testcase_41 WA -
testcase_42 WA -
testcase_43 AC 19 ms
8,516 KB
testcase_44 WA -
testcase_45 AC 18 ms
8,508 KB
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
S = input()
memo = {}
memo[S] = 0
Queue = deque()
Queue.append((S, 0))
while Queue:
    x,cnt = Queue.popleft()
    y = x[1] + x[0] + x[2]
    if not y in memo:
        memo[y] = cnt + 1
        Queue.append((y, cnt+1))
    y = x[0] + x[2] + x[1]
    if not y in memo:
        memo[y] = cnt + 1
        Queue.append((y, cnt+1))
N = int(input())
S = input()
if not S in memo:
    print('SUCCESS')
elif memo[S] <= N and memo[S] % 2 == N % 2:
    print('FAILURE')
else:
    print('SUCCESS')
0