結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
15,092 KB
testcase_01 AC 81 ms
14,984 KB
testcase_02 AC 675 ms
16,116 KB
testcase_03 AC 629 ms
15,884 KB
testcase_04 AC 712 ms
16,044 KB
testcase_05 AC 635 ms
15,904 KB
testcase_06 AC 719 ms
15,940 KB
testcase_07 AC 657 ms
16,084 KB
testcase_08 AC 728 ms
16,048 KB
testcase_09 AC 650 ms
16,068 KB
testcase_10 AC 689 ms
16,052 KB
testcase_11 AC 722 ms
16,112 KB
testcase_12 AC 743 ms
16,040 KB
testcase_13 AC 702 ms
15,884 KB
testcase_14 AC 665 ms
15,908 KB
testcase_15 AC 670 ms
15,860 KB
testcase_16 AC 680 ms
15,868 KB
testcase_17 AC 750 ms
15,916 KB
testcase_18 AC 681 ms
15,912 KB
testcase_19 AC 763 ms
15,788 KB
testcase_20 AC 715 ms
16,088 KB
testcase_21 AC 759 ms
15,976 KB
testcase_22 AC 1,318 ms
16,808 KB
testcase_23 AC 84 ms
15,256 KB
testcase_24 AC 1,255 ms
16,896 KB
testcase_25 AC 84 ms
15,044 KB
testcase_26 AC 82 ms
15,080 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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