結果
問題 | No.258 回転寿司(2) |
ユーザー |
![]() |
提出日時 | 2015-08-05 11:53:12 |
言語 | Ruby (3.4.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 444 bytes |
コンパイル時間 | 305 ms |
コンパイル使用メモリ | 7,424 KB |
実行使用メモリ | 13,824 KB |
最終ジャッジ日時 | 2024-11-24 10:13:42 |
合計ジャッジ時間 | 8,500 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 3 |
other | WA * 67 |
コンパイルメッセージ
Main.rb:1: warning: assigned but unused variable - n Syntax OK
ソースコード
n = gets.strip.to_i v = gets.strip.split(' ').map(&:to_i) total = [0, 0] dish0 = [] dish1 = [] (0..v.length-1).each do |i| dish = dish0.clone dish0 = dish1.clone dish1 = dish.clone tmp = total[1] + v[i] if total[0] > total[1] total[1] = total[0] else dish1 = dish0.clone end total[0] = tmp dish0 << i + 1 # print "#{dish0}, #{dish1}\n" end puts total.max if total[0] > total[1] puts dish0.join(',') else puts dish1.join(',') end