結果

問題 No.1160 Strange Bowling
ユーザー 小野寺健小野寺健
提出日時 2021-11-02 16:43:55
言語 Ruby
(3.3.0)
結果
AC  
実行時間 278 ms / 2,000 ms
コード長 290 bytes
コンパイル時間 40 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 28,800 KB
最終ジャッジ日時 2024-04-20 02:29:37
合計ジャッジ時間 6,228 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 81 ms
12,160 KB
testcase_01 AC 76 ms
12,416 KB
testcase_02 AC 83 ms
12,160 KB
testcase_03 AC 75 ms
12,288 KB
testcase_04 AC 74 ms
12,416 KB
testcase_05 AC 72 ms
12,160 KB
testcase_06 AC 73 ms
12,288 KB
testcase_07 AC 73 ms
12,288 KB
testcase_08 AC 73 ms
12,288 KB
testcase_09 AC 75 ms
12,288 KB
testcase_10 AC 226 ms
23,552 KB
testcase_11 AC 155 ms
18,304 KB
testcase_12 AC 115 ms
15,104 KB
testcase_13 AC 95 ms
13,440 KB
testcase_14 AC 217 ms
22,528 KB
testcase_15 AC 106 ms
14,208 KB
testcase_16 AC 121 ms
15,104 KB
testcase_17 AC 200 ms
21,760 KB
testcase_18 AC 163 ms
19,072 KB
testcase_19 AC 134 ms
16,384 KB
testcase_20 AC 180 ms
20,480 KB
testcase_21 AC 157 ms
18,304 KB
testcase_22 AC 99 ms
13,952 KB
testcase_23 AC 98 ms
13,824 KB
testcase_24 AC 97 ms
13,568 KB
testcase_25 AC 139 ms
16,896 KB
testcase_26 AC 104 ms
14,208 KB
testcase_27 AC 172 ms
19,712 KB
testcase_28 AC 109 ms
14,336 KB
testcase_29 AC 213 ms
22,528 KB
testcase_30 AC 278 ms
28,800 KB
testcase_31 AC 191 ms
20,608 KB
testcase_32 AC 115 ms
14,336 KB
testcase_33 AC 181 ms
18,688 KB
testcase_34 AC 161 ms
18,048 KB
testcase_35 AC 262 ms
26,240 KB
testcase_36 AC 79 ms
12,288 KB
testcase_37 AC 75 ms
12,288 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Main.rb:9: warning: assigned but unused variable - a
Syntax OK

ソースコード

diff #

N = gets.to_i

pa = []

N.times {
	pa.unshift(gets.split(" ").map{|s| s.to_i})
}

p, a = pa.shift

pn = [[p, p]]
sn = [[p, p]]

pa.each {|p, a|
	np, na = pn[-1]
	sp, sa = sn[-1]
	ca = [np + a + sp, na + a + sa].max
	cp = [p + sp, p + sa].max
	pn << [p, a]
	sn << [cp, ca]
}

puts sn[-1].max
0