結果

問題 No.710 チーム戦
ユーザー %20%20
提出日時 2018-12-09 21:01:46
言語 Ruby
(3.3.0)
結果
AC  
実行時間 1,320 ms / 3,000 ms
コード長 236 bytes
コンパイル時間 416 ms
コンパイル使用メモリ 11,452 KB
実行使用メモリ 16,044 KB
最終ジャッジ日時 2023-10-14 21:50:57
合計ジャッジ時間 19,695 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,080 KB
testcase_01 AC 84 ms
15,144 KB
testcase_02 AC 674 ms
15,580 KB
testcase_03 AC 627 ms
15,412 KB
testcase_04 AC 706 ms
15,688 KB
testcase_05 AC 639 ms
15,368 KB
testcase_06 AC 718 ms
15,820 KB
testcase_07 AC 672 ms
15,452 KB
testcase_08 AC 715 ms
15,812 KB
testcase_09 AC 653 ms
15,652 KB
testcase_10 AC 691 ms
15,660 KB
testcase_11 AC 717 ms
15,660 KB
testcase_12 AC 746 ms
15,620 KB
testcase_13 AC 699 ms
15,468 KB
testcase_14 AC 666 ms
15,348 KB
testcase_15 AC 673 ms
15,464 KB
testcase_16 AC 678 ms
15,416 KB
testcase_17 AC 748 ms
15,784 KB
testcase_18 AC 682 ms
15,452 KB
testcase_19 AC 764 ms
15,788 KB
testcase_20 AC 713 ms
15,680 KB
testcase_21 AC 768 ms
15,668 KB
testcase_22 AC 1,320 ms
16,044 KB
testcase_23 AC 85 ms
15,108 KB
testcase_24 AC 1,253 ms
15,964 KB
testcase_25 AC 83 ms
15,152 KB
testcase_26 AC 84 ms
15,164 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N=gets.to_i
a=[]
b=[]
N.times{|i|
	a[i],b[i]=gets.split.map &:to_i
}
s=0
b.map{|b|s+=b}
d=[0]*(s+1)
N.times{|i|
	(d.size-1).downto(a[i]){|j|
		d[j]=[d[j],d[j-a[i]]+b[i]].max
	}
}
z=10**9
d.size.times{|i|
	z=[z,[i,s-d[i]].max].min
}
p z
0