結果
| 問題 |
No.178 美しいWhitespace (1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2015-04-05 23:38:33 |
| 言語 | Ruby (3.4.1) |
| 結果 |
AC
|
| 実行時間 | 91 ms / 2,000 ms |
| コード長 | 233 bytes |
| コンパイル時間 | 94 ms |
| コンパイル使用メモリ | 7,424 KB |
| 実行使用メモリ | 12,416 KB |
| 最終ジャッジ日時 | 2024-07-04 02:13:04 |
| 合計ジャッジ時間 | 3,071 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 21 |
コンパイルメッセージ
Main.rb:5: warning: ambiguous first argument; put parentheses or a space even after `-' operator Syntax OK
ソースコード
n = gets.to_i
a = n.times.map{gets.split.map(&:to_i)}
sum = a.map{|s,t| s + 4 * t}
if !sum.all?{|e| e.even? } && !sum.all?{|e| e.odd? }
puts -1
else
max = sum.max
ret = sum.map{|s| (max - s) / 2 }.inject(:+)
p ret
end