結果

問題 No.197 手品
ユーザー H20
提出日時 2021-03-05 11:24:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 44 ms / 1,000 ms
コード長 550 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 54,016 KB
最終ジャッジ日時 2024-10-06 08:07:58
合計ジャッジ時間 3,463 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections
SB = input()
N=int(input())
SA = input()

if collections.Counter(SB) - collections.Counter(SA):
    print('SUCCESS')
elif N==0:
    if SA==SB:
        print('FAILURE')
    else:
        print('SUCCESS')
elif N<6:
    for i in range(2 ** N):
        B = SB
        for j in range(N):
            if ((i >> j) & 1):
                B = B[1]+B[0]+B[2]                
            else:
                B = B[0]+B[2]+B[1]
        if SA==B:
            print('FAILURE')
            exit()
    print('SUCCESS')
else:
    print('FAILURE')
0