結果

問題 No.197 手品
ユーザー 🍡yurahuna
提出日時 2016-07-19 14:46:52
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 30 ms / 1,000 ms
コード長 490 bytes
コンパイル時間 105 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-20 03:48:56
合計ジャッジ時間 2,437 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

def possible(s, t, n):
    if s.count('o') != t.count('o'):
        return False

    if s.count('o') > 1:
        s = s.translate(str.maketrans('ox', 'xo'))
        t = t.translate(str.maketrans('ox', 'xo'))

    if n == 0 or s.count('o') == 0:
        return s == t

    # s.count('o') == 1
    if n == 1:
        return not (s[1] == t[1] == 'o' or s == t[::-1])
    else:
        return True

s = input()
n = int(input())
t = input()
print('FAILURE' if possible(s, t, n) else 'SUCCESS')
0