結果

問題 No.197 手品
ユーザー FromBooskaFromBooska
提出日時 2023-03-01 19:35:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 69 ms / 1,000 ms
コード長 2,101 bytes
コンパイル時間 1,223 ms
コンパイル使用メモリ 86,520 KB
実行使用メモリ 71,212 KB
最終ジャッジ日時 2023-10-14 23:13:55
合計ジャッジ時間 5,672 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
70,948 KB
testcase_01 AC 67 ms
70,860 KB
testcase_02 AC 66 ms
70,860 KB
testcase_03 AC 64 ms
70,828 KB
testcase_04 AC 67 ms
71,072 KB
testcase_05 AC 66 ms
71,184 KB
testcase_06 AC 67 ms
70,848 KB
testcase_07 AC 65 ms
71,148 KB
testcase_08 AC 65 ms
71,024 KB
testcase_09 AC 66 ms
70,680 KB
testcase_10 AC 66 ms
70,880 KB
testcase_11 AC 65 ms
70,992 KB
testcase_12 AC 65 ms
71,188 KB
testcase_13 AC 66 ms
71,052 KB
testcase_14 AC 65 ms
71,052 KB
testcase_15 AC 67 ms
70,848 KB
testcase_16 AC 65 ms
70,700 KB
testcase_17 AC 65 ms
71,148 KB
testcase_18 AC 66 ms
70,684 KB
testcase_19 AC 69 ms
70,856 KB
testcase_20 AC 66 ms
70,852 KB
testcase_21 AC 67 ms
70,660 KB
testcase_22 AC 63 ms
71,020 KB
testcase_23 AC 66 ms
71,144 KB
testcase_24 AC 66 ms
70,892 KB
testcase_25 AC 67 ms
70,860 KB
testcase_26 AC 67 ms
71,188 KB
testcase_27 AC 68 ms
70,836 KB
testcase_28 AC 66 ms
70,860 KB
testcase_29 AC 66 ms
70,836 KB
testcase_30 AC 69 ms
71,168 KB
testcase_31 AC 68 ms
70,808 KB
testcase_32 AC 68 ms
71,036 KB
testcase_33 AC 68 ms
70,992 KB
testcase_34 AC 69 ms
71,212 KB
testcase_35 AC 69 ms
70,880 KB
testcase_36 AC 67 ms
71,024 KB
testcase_37 AC 68 ms
70,860 KB
testcase_38 AC 68 ms
70,840 KB
testcase_39 AC 67 ms
70,932 KB
testcase_40 AC 69 ms
71,044 KB
testcase_41 AC 67 ms
71,052 KB
testcase_42 AC 68 ms
70,848 KB
testcase_43 AC 68 ms
71,000 KB
testcase_44 AC 68 ms
70,700 KB
testcase_45 AC 66 ms
70,908 KB
testcase_46 AC 68 ms
70,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# o, xの数が異なれば常にsuccess
# 数が同じ時
# 数が同じでもooo or xxxは常にfailure
# 数が同じで1個2個パターンのときどうなるか oxx, oox 
# 2回以上ならどんなパターンにもできるので、常にfailure
# 数が同じで、1個2個で、1回だけのときは、できるパターンが限られる、できるならsuccess, or failure

S_before = input()
count_before = S_before.count('o')
N = int(input())
S_after = input()
count_after = S_after.count('o')

if count_before != count_after:
    ans = 'SUCCESS'
else:
    # つまり数は同じ
    if count_before == 0 or count_before == 3:
        ans = 'FAILURE'
    else:
        # つまり数は同じで1個2個に分かれている
        if N >= 2: 
            ans = 'FAILURE'
        elif N == 0:
            if S_before == S_after:
                ans = 'FAILURE'
            else:
                ans = 'SUCCESS'
        elif N == 1:
            if S_before == 'oxx':
                if S_after == 'oxx' or S_after == 'xox':
                    ans = 'FAILURE'
                else:
                    ans = 'SUCCESS'
            if S_before == 'xox':
                if S_after == 'oxx' or S_after == 'xxo':
                    ans = 'FAILURE'
                else:
                    ans = 'SUCCESS'            
            if S_before == 'xxo':
                if S_after == 'xxo' or S_after == 'xox':
                    ans = 'FAILURE'
                else:
                    ans = 'SUCCESS'    
            if S_before == 'xoo':
                if S_after == 'xoo' or S_after == 'oxo':
                    ans = 'FAILURE'
                else:
                    ans = 'SUCCESS'
            if S_before == 'oxo':
                if S_after == 'xoo' or S_after == 'oox':
                    ans = 'FAILURE'
                else:
                    ans = 'SUCCESS'            
            if S_before == 'oox':
                if S_after == 'oox' or S_after == 'oxo':
                    ans = 'FAILURE'
                else:
                    ans = 'SUCCESS'  
print(ans)
0