結果

問題 No.2315 Flying Camera
ユーザー 👑 horiesinitihoriesiniti
提出日時 2023-07-03 10:05:15
言語 Ruby
(3.3.0)
結果
AC  
実行時間 99 ms / 2,000 ms
コード長 285 bytes
コンパイル時間 490 ms
コンパイル使用メモリ 11,184 KB
実行使用メモリ 15,348 KB
最終ジャッジ日時 2023-09-24 07:01:18
合計ジャッジ時間 4,230 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
15,260 KB
testcase_01 AC 82 ms
15,328 KB
testcase_02 AC 83 ms
15,128 KB
testcase_03 AC 94 ms
15,104 KB
testcase_04 AC 97 ms
15,104 KB
testcase_05 AC 96 ms
15,016 KB
testcase_06 AC 88 ms
15,100 KB
testcase_07 AC 95 ms
15,100 KB
testcase_08 AC 86 ms
15,016 KB
testcase_09 AC 83 ms
15,336 KB
testcase_10 AC 89 ms
15,284 KB
testcase_11 AC 97 ms
15,244 KB
testcase_12 AC 86 ms
15,168 KB
testcase_13 AC 85 ms
15,140 KB
testcase_14 AC 96 ms
15,108 KB
testcase_15 AC 91 ms
15,276 KB
testcase_16 AC 90 ms
15,348 KB
testcase_17 AC 85 ms
15,244 KB
testcase_18 AC 97 ms
15,104 KB
testcase_19 AC 93 ms
15,340 KB
testcase_20 AC 85 ms
15,100 KB
testcase_21 AC 88 ms
15,076 KB
testcase_22 AC 85 ms
15,240 KB
testcase_23 AC 81 ms
15,152 KB
testcase_24 AC 99 ms
15,152 KB
testcase_25 AC 81 ms
15,120 KB
testcase_26 AC 99 ms
15,340 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

n=gets.to_i
xs=[]
ys=[]
n.times{|i|
	x,y=gets.split(" ").map{|e| e.to_i}
	xs<<x
	ys<<y
}
ansx=10**18
ansy=10**18
1.upto(300){|i|
	sum=0
	xs.each{|x|
		sum+=(x-i).abs
	}
	ansx=[ansx,sum].min
}
1.upto(300){|i|
	sum=0
	ys.each{|y|
		sum+=(y-i).abs
	}
	ansy=[ansy,sum].min
}
puts ansx+ansy
0