結果
| 問題 | 
                            No.197 手品
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2017-06-06 13:26:04 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 33 ms / 1,000 ms | 
| コード長 | 1,361 bytes | 
| コンパイル時間 | 85 ms | 
| コンパイル使用メモリ | 12,544 KB | 
| 実行使用メモリ | 10,880 KB | 
| 最終ジャッジ日時 | 2024-07-20 03:52:11 | 
| 合計ジャッジ時間 | 2,783 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 43 | 
ソースコード
import sys
def solve():
    sb = input()
    n = int(input())
    sa = input()
    f = 'FAILURE'
    s = 'SUCCESS'
    if n == 0:
        if sb == sa:
            print(f)
        else:
            print(s)
        return
    if sb == 'ooo' or sb == 'xxx':
        if sb == sa:
            print(f)
        else:
            print(s)
        return
    if sb.count('o') != sa.count('o'):
        print(s)
        return
    if n == 1:
        if sb == 'oxx':
            if sa == 'oxx' or sa == 'xox':
                print(f)
            else:
                print(s)
        elif sb == 'xox':
            if sa == 'oxx' or sa == 'xxo':
                print(f)
            else:
                print(s)
        elif sb == 'xxo':
            if sa == 'xxo' or sa == 'xox':
                print(f)
            else:
                print(s)
        elif sb == 'oox':
            if sa == 'oox' or sa == 'oxo':
                print(f)
            else:
                print(s)
        elif sb == 'oxo':
            if sa == 'oox' or sa == 'xoo':
                print(f)
            else:
                print(s)
        elif sb == 'xoo':
            if sa == 'oxo' or sa == 'xoo':
                print(f)
            else:
                print(s)
        else:
            raise
    else:
        print(f)
if __name__ == '__main__':
    solve()