結果

問題 No.228 ゆきこちゃんの 15 パズル
ユーザー finefine
提出日時 2016-03-29 19:22:32
言語 Ruby
(3.3.0)
結果
WA  
実行時間 -
コード長 474 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 12,288 KB
最終ジャッジ日時 2024-04-10 05:51:12
合計ジャッジ時間 2,720 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 81 ms
12,160 KB
testcase_02 AC 80 ms
12,288 KB
testcase_03 AC 80 ms
12,288 KB
testcase_04 AC 79 ms
12,160 KB
testcase_05 AC 83 ms
12,160 KB
testcase_06 AC 79 ms
12,160 KB
testcase_07 AC 80 ms
12,160 KB
testcase_08 AC 79 ms
12,288 KB
testcase_09 AC 78 ms
12,160 KB
testcase_10 AC 80 ms
12,288 KB
testcase_11 AC 78 ms
12,288 KB
testcase_12 WA -
testcase_13 AC 86 ms
12,160 KB
testcase_14 AC 83 ms
12,160 KB
testcase_15 AC 81 ms
12,032 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 80 ms
12,288 KB
testcase_19 AC 81 ms
12,160 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

def hoge x, a
    if a[x - 1] == x
        return true
    end
    if x % 4 != 0 && a[x] == x
        return true
    end
    if x % 4 != 1 && a[x - 2] == x
        return true
    end
    if x > 4  && a[x - 5] == x
        return true
    end
    if (x - 1) / 4 != 3 && a[x + 3] == x
        return true
    end
    return false
end

a = STDIN.map{|s|s.split.map(&:to_i)}.flatten
1.upto(15){|x|
    if hoge(x, a)
        next
    end
    puts 'No'
    exit
    }
puts 'Yes'
0