結果

問題 No.197 手品
ユーザー koyoprokoyopro
提出日時 2015-09-20 19:57:08
言語 Python2
(2.7.18)
結果
AC  
実行時間 11 ms / 1,000 ms
コード長 861 bytes
コンパイル時間 63 ms
コンパイル使用メモリ 6,568 KB
実行使用メモリ 6,008 KB
最終ジャッジ日時 2023-09-27 09:34:43
合計ジャッジ時間 1,945 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
5,860 KB
testcase_01 AC 11 ms
5,864 KB
testcase_02 AC 11 ms
5,948 KB
testcase_03 AC 10 ms
5,932 KB
testcase_04 AC 10 ms
6,004 KB
testcase_05 AC 10 ms
6,008 KB
testcase_06 AC 10 ms
5,948 KB
testcase_07 AC 10 ms
5,852 KB
testcase_08 AC 9 ms
5,916 KB
testcase_09 AC 10 ms
5,916 KB
testcase_10 AC 9 ms
6,004 KB
testcase_11 AC 9 ms
5,988 KB
testcase_12 AC 10 ms
5,848 KB
testcase_13 AC 10 ms
5,944 KB
testcase_14 AC 10 ms
5,920 KB
testcase_15 AC 10 ms
5,856 KB
testcase_16 AC 10 ms
5,952 KB
testcase_17 AC 9 ms
5,912 KB
testcase_18 AC 9 ms
5,948 KB
testcase_19 AC 9 ms
5,856 KB
testcase_20 AC 10 ms
5,920 KB
testcase_21 AC 9 ms
5,932 KB
testcase_22 AC 11 ms
5,944 KB
testcase_23 AC 10 ms
5,912 KB
testcase_24 AC 10 ms
5,852 KB
testcase_25 AC 10 ms
5,888 KB
testcase_26 AC 9 ms
5,932 KB
testcase_27 AC 10 ms
6,004 KB
testcase_28 AC 10 ms
5,932 KB
testcase_29 AC 10 ms
5,860 KB
testcase_30 AC 10 ms
5,852 KB
testcase_31 AC 10 ms
5,852 KB
testcase_32 AC 9 ms
5,940 KB
testcase_33 AC 10 ms
6,004 KB
testcase_34 AC 10 ms
5,928 KB
testcase_35 AC 10 ms
5,932 KB
testcase_36 AC 9 ms
5,924 KB
testcase_37 AC 10 ms
5,916 KB
testcase_38 AC 10 ms
5,948 KB
testcase_39 AC 10 ms
5,856 KB
testcase_40 AC 10 ms
5,948 KB
testcase_41 AC 10 ms
5,856 KB
testcase_42 AC 10 ms
5,940 KB
testcase_43 AC 10 ms
5,856 KB
testcase_44 AC 10 ms
5,920 KB
testcase_45 AC 9 ms
5,916 KB
testcase_46 AC 9 ms
5,952 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# -*- coding: utf-8 -*-

sb, = map(str, raw_input().split())
n, = map(int, raw_input().split())
sa, = map(str, raw_input().split())

dic = {'x': 0, 'o': 0}
for s in sb: dic[s] += 1
dicm = dic.copy()
for s in sa: dic[s] -= 1

# 数が変われば手品成功
if dic['x'] != 0 or dic['o'] != 0:
    print 'SUCCESS'
    exit()

# 0回: 変わっていれば成功
if n == 0:
    print 'SUCCESS' if sb != sa else 'FAILURE'
    exit()

odd = 'x' if dicm['x'] % 2 == 1 else 'o'
nodd = n % 2 == 1

odd_pos_b = sb.find(odd)
odd_pos_a = sa.find(odd)

diff = abs(odd_pos_a - odd_pos_b)

if n >= diff:
    # 移動回数が差分以上ならあり得る
    if n == 1 and diff == 0:
        if odd_pos_b == 1:
            # ありえない
            print 'SUCCESS'
        else:
            print 'FAILURE'
        exit()
    print 'FAILURE'
else:
    print 'SUCCESS'

0