結果
問題 | No.240 ナイト散歩 |
ユーザー |
![]() |
提出日時 | 2016-09-16 21:30:51 |
言語 | Ruby (3.4.1) |
結果 |
AC
|
実行時間 | 95 ms / 2,000 ms |
コード長 | 595 bytes |
コンパイル時間 | 195 ms |
コンパイル使用メモリ | 7,296 KB |
実行使用メモリ | 12,672 KB |
最終ジャッジ日時 | 2024-10-07 21:29:59 |
合計ジャッジ時間 | 4,415 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 30 |
コンパイルメッセージ
Syntax OK
ソースコード
dx = [-2,-2,-1,-1,1,1,2,2]dy = [-1,1,-2,2,-2,2,-1,1]conbi = (dx.zip(dy).map {|x, y|[x,y]} * 3 ).combination(3).map { |x|x} + (dx.zip(dy).map {|x, y|[x,y]} * 2 ).combination(2).map { |x|x} + (dx.zip(dy).map {|x, y|[x,y]} * 1 ).combination(1).map { |x|x}conbix = conbi.map{ |x|x.map { |x| x[0] }.inject { |a,x| a+x }}conbiy = conbi.map{ |x|x.map { |x| x[1] }.inject { |a,x| a+x }}reduced = conbix.zip(conbiy)reduced.push([0,0])x, y = gets.split(" ").map { |x| x.to_i }if reduced.include?([x,y]) thenputs "YES"elseputs "NO"end