結果

問題 No.1160 Strange Bowling
ユーザー 👑 tatt61880tatt61880
提出日時 2021-02-20 18:21:23
言語 Kuin
(KuinC++ v.2021.9.17)
結果
AC  
実行時間 104 ms / 2,000 ms
コード長 539 bytes
コンパイル時間 2,407 ms
コンパイル使用メモリ 153,168 KB
実行使用メモリ 14,468 KB
最終ジャッジ日時 2023-10-14 17:13:52
合計ジャッジ時間 6,880 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 2 ms
4,352 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 2 ms
4,352 KB
testcase_08 AC 2 ms
4,352 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 72 ms
11,564 KB
testcase_11 AC 40 ms
7,816 KB
testcase_12 AC 21 ms
5,556 KB
testcase_13 AC 12 ms
4,868 KB
testcase_14 AC 65 ms
10,892 KB
testcase_15 AC 17 ms
5,228 KB
testcase_16 AC 21 ms
5,604 KB
testcase_17 AC 61 ms
10,364 KB
testcase_18 AC 43 ms
8,076 KB
testcase_19 AC 29 ms
6,644 KB
testcase_20 AC 51 ms
9,192 KB
testcase_21 AC 40 ms
8,028 KB
testcase_22 AC 14 ms
5,056 KB
testcase_23 AC 14 ms
5,092 KB
testcase_24 AC 13 ms
5,048 KB
testcase_25 AC 32 ms
6,948 KB
testcase_26 AC 17 ms
5,220 KB
testcase_27 AC 47 ms
8,544 KB
testcase_28 AC 18 ms
5,364 KB
testcase_29 AC 65 ms
10,892 KB
testcase_30 AC 104 ms
14,468 KB
testcase_31 AC 55 ms
9,516 KB
testcase_32 AC 18 ms
5,316 KB
testcase_33 AC 39 ms
7,732 KB
testcase_34 AC 37 ms
7,552 KB
testcase_35 AC 87 ms
13,296 KB
testcase_36 AC 2 ms
4,352 KB
testcase_37 AC 2 ms
4,356 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

func main()
	var n: int :: cui@inputInt()
	var p: []int :: #[n]int
	var a: []int :: #[n]int
	for i(0, n - 1)
		do p[i] :: cui@inputInt()
		do a[i] :: cui@inputInt()
	end for
	
	; i本目, j = 0 => p本を選んだ。j=1 => a本を選んだ。
	var dp: [][]int :: #[n, 2]int
	do dp[0][0] :: p[0]
	do dp[0][1] :: a[0]
	for i(1, n - 1)
		do dp[i][0] :: [dp[i - 1][0], dp[i - 1][1] + p[i]].max() + p[i]
		do dp[i][1] :: [dp[i - 1][0], dp[i - 1][1] + a[i]].max() + a[i]
	end for
	var ans: int :: dp[n - 1][0]
	do cui@print("\{ans}\n")
end func
0