結果

問題 No.197 手品
ユーザー yamaghyamagh
提出日時 2015-04-29 00:24:28
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 551 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 11,144 KB
実行使用メモリ 15,316 KB
最終ジャッジ日時 2023-09-09 15:30:43
合計ジャッジ時間 5,956 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 78 ms
15,140 KB
testcase_01 AC 79 ms
15,216 KB
testcase_02 AC 78 ms
15,084 KB
testcase_03 AC 78 ms
15,068 KB
testcase_04 AC 77 ms
15,092 KB
testcase_05 AC 77 ms
15,220 KB
testcase_06 AC 77 ms
15,080 KB
testcase_07 AC 79 ms
15,108 KB
testcase_08 AC 78 ms
15,052 KB
testcase_09 AC 78 ms
15,048 KB
testcase_10 AC 77 ms
15,224 KB
testcase_11 AC 78 ms
15,000 KB
testcase_12 AC 79 ms
15,008 KB
testcase_13 AC 77 ms
14,996 KB
testcase_14 WA -
testcase_15 AC 77 ms
15,048 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 77 ms
15,228 KB
testcase_24 AC 77 ms
15,088 KB
testcase_25 AC 77 ms
15,216 KB
testcase_26 AC 78 ms
15,108 KB
testcase_27 AC 77 ms
15,132 KB
testcase_28 AC 78 ms
15,252 KB
testcase_29 AC 79 ms
15,012 KB
testcase_30 AC 77 ms
15,092 KB
testcase_31 AC 77 ms
15,116 KB
testcase_32 AC 77 ms
15,060 KB
testcase_33 AC 78 ms
15,276 KB
testcase_34 AC 79 ms
15,152 KB
testcase_35 AC 78 ms
15,280 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 78 ms
15,104 KB
testcase_39 AC 77 ms
15,264 KB
testcase_40 AC 76 ms
15,008 KB
testcase_41 AC 78 ms
15,240 KB
testcase_42 AC 76 ms
15,064 KB
testcase_43 AC 77 ms
15,124 KB
testcase_44 WA -
testcase_45 AC 78 ms
15,016 KB
testcase_46 AC 78 ms
15,060 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

bef, n, aft = gets, gets.to_i, gets

o, x = bef.count('o'), bef.count('x')

if bef.count('o') != aft.count('o')
  puts 'SUCCESS' 
  exit
end

if o == 3 || o == 0
  puts 'FAILURE'
  exit
end

sign = o<x ? 'o' : 'x'
idx  = bef.index(sign) 

if idx.odd?
  if n.even?
    puts 'FAILURE'
    exit
  else
    puts aft.index(sign)==idx ? 'SUCCESS' : 'FAILURE'
  end
else
  aft_idx = aft.index(sign)
  if n.even?
    puts aft_idx.even? ? 'FAILURE' : 'SUCCESS'
  else
    puts (idx==0 && aft_idx==2) || (idx==2 && aft_idx==0) ? 'SUCCESS' : 'FAILURE'
  end
end
0