結果
| 問題 |
No.467 隠されていたゲーム
|
| コンテスト | |
| ユーザー |
suppy193
|
| 提出日時 | 2017-01-11 11:38:28 |
| 言語 | Ruby (3.4.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 806 bytes |
| コンパイル時間 | 74 ms |
| コンパイル使用メモリ | 7,552 KB |
| 実行使用メモリ | 315,640 KB |
| 最終ジャッジ日時 | 2024-12-21 07:28:07 |
| 合計ジャッジ時間 | 19,143 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 5 WA * 14 TLE * 5 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n Main.rb:6: warning: assigned but unused variable - x Main.rb:6: warning: assigned but unused variable - y Syntax OK
ソースコード
n = gets.to_i
@cheby = gets.strip.split(' ').map(&:to_i)
#p @cheby
@goal = gets.strip.split(' ').map(&:to_i)
#p @goal
x, y = 0, 0
points_x = [0]
count_x = 0
100.times do
next_points_x = []
count_x += 1
points_x.each do |point_x|
@cheby.each do |d|
next_points_x << point_x - d
next_points_x << point_x + d
end
end
if next_points_x.include?(@goal[0])
#p count_x
break
end
#p next_points
points_x = next_points_x.uniq
end
#p points_x
points_y = [0]
count_y = 0
100.times do
next_points_y = []
count_y += 1
points_y.each do |point_y|
@cheby.each do |d|
next_points_y << point_y - d
next_points_y << point_y + d
end
end
if next_points_y.include?(@goal[1])
#p count_y
break
end
#p next_points
points_y = next_points_y.uniq
end
#p points_y
p [count_x, count_y].max
suppy193