結果
| 問題 | 
                            No.197 手品
                             | 
                    
| コンテスト | |
| ユーザー | 
                             siman
                         | 
                    
| 提出日時 | 2016-03-22 07:04:50 | 
| 言語 | Ruby  (3.4.1)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 600 bytes | 
| コンパイル時間 | 82 ms | 
| コンパイル使用メモリ | 7,680 KB | 
| 実行使用メモリ | 12,416 KB | 
| 最終ジャッジ日時 | 2024-06-27 13:27:26 | 
| 合計ジャッジ時間 | 5,416 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 40 WA * 3 | 
コンパイルメッセージ
Syntax OK
ソースコード
class Yukicoder
  def initialize
    s1 = gets.chomp.chars
    n = gets.to_i
    s2 = gets.chomp.chars
    success = true
    success &= s1.sort == s2.sort
    if success && (s1 & s2).size == 2
      o_diff = (s1.index('o') - s2.index('o')).abs
      x_diff = (s1.index('x') - s1.index('x')).abs
      diff = [o_diff, x_diff].max
      success &= diff <= n
      if n == 1 && diff == 0 && ([s1,s2].include?(%w(o x o)) || [s1,s2].include?(%w(x o x)))
        success &= diff > 0
      end
    end
    if success
      puts "FAILURE"
    else
      puts "SUCCESS"
    end
  end
end
Yukicoder.new
            
            
            
        
            
siman