結果

問題 No.197 手品
ユーザー Hachimori
提出日時 2015-04-29 00:10:16
言語 Python2
(2.7.18)
結果
AC  
実行時間 12 ms / 1,000 ms
コード長 576 bytes
コンパイル時間 57 ms
コンパイル使用メモリ 7,040 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2024-07-20 03:35:47
合計ジャッジ時間 1,696 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
#coding:utf8

def read():
    return list(raw_input()), input(), list(raw_input())


def work((S, N, T)):
    if S.count('o') != T.count('o') or S.count('x') != T.count('x'):
        print "SUCCESS"
        return

    cost = 0
    for i in range(len(S)):
        for j in range(i + 1, len(S)):
            if S[i] != T[i] and S[j] != T[j]:
                cost = abs(i - j)

    if cost > N or (S == T and N == 1 and S[0] != S[1] and S[0] == S[2]):
        print "SUCCESS"
    else:
        print "FAILURE"


if __name__ == "__main__":
    work(read())
0