Submission #57302943


Source Code Expand

n = int(input())
a = [int(i) for i in input().split()]

dp = [[0, a[0]], [0, 0]]
for v in a[1:]:
	dp[1][0] = max(dp[0][0], dp[0][1] + v * 2)
	dp[1][1] = max(dp[0][1], dp[0][0] + v)
	dp[0][0], dp[0][1] = dp[1][0], dp[1][1]

print(max(dp[0]))

Submission Info

Submission Time
Task D - Bonus EXP
User c1ampy
Language Python (CPython 3.11.4)
Score 400
Code Size 251 Byte
Status AC
Exec Time 158 ms
Memory 31788 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 49
Set Name Test Cases
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt, random_20.txt, random_21.txt, random_22.txt, random_23.txt, random_24.txt, random_25.txt, random_26.txt, random_27.txt, random_28.txt, random_29.txt, random_30.txt, random_31.txt, random_32.txt, random_33.txt, random_34.txt, random_35.txt, random_36.txt, random_37.txt, random_38.txt, random_39.txt
Case Name Status Exec Time Memory
example_00.txt AC 9 ms 8384 KiB
example_01.txt AC 9 ms 8520 KiB
hand_00.txt AC 137 ms 21216 KiB
hand_01.txt AC 146 ms 30644 KiB
hand_02.txt AC 9 ms 8528 KiB
hand_03.txt AC 137 ms 21136 KiB
hand_04.txt AC 142 ms 24224 KiB
hand_05.txt AC 154 ms 30632 KiB
hand_06.txt AC 10 ms 8432 KiB
random_00.txt AC 138 ms 25240 KiB
random_01.txt AC 144 ms 31672 KiB
random_02.txt AC 140 ms 31416 KiB
random_03.txt AC 137 ms 28256 KiB
random_04.txt AC 143 ms 30632 KiB
random_05.txt AC 145 ms 30576 KiB
random_06.txt AC 136 ms 31412 KiB
random_07.txt AC 143 ms 31788 KiB
random_08.txt AC 135 ms 24296 KiB
random_09.txt AC 144 ms 30600 KiB
random_10.txt AC 142 ms 31688 KiB
random_11.txt AC 127 ms 12008 KiB
random_12.txt AC 138 ms 31736 KiB
random_13.txt AC 135 ms 25264 KiB
random_14.txt AC 150 ms 30600 KiB
random_15.txt AC 145 ms 31660 KiB
random_16.txt AC 146 ms 30652 KiB
random_17.txt AC 145 ms 30596 KiB
random_18.txt AC 133 ms 21452 KiB
random_19.txt AC 143 ms 27840 KiB
random_20.txt AC 148 ms 31704 KiB
random_21.txt AC 151 ms 30600 KiB
random_22.txt AC 147 ms 29460 KiB
random_23.txt AC 144 ms 28580 KiB
random_24.txt AC 147 ms 31388 KiB
random_25.txt AC 148 ms 28748 KiB
random_26.txt AC 152 ms 28740 KiB
random_27.txt AC 147 ms 28720 KiB
random_28.txt AC 150 ms 28816 KiB
random_29.txt AC 146 ms 28612 KiB
random_30.txt AC 156 ms 30724 KiB
random_31.txt AC 154 ms 30652 KiB
random_32.txt AC 147 ms 30584 KiB
random_33.txt AC 147 ms 30756 KiB
random_34.txt AC 148 ms 30624 KiB
random_35.txt AC 147 ms 30600 KiB
random_36.txt AC 154 ms 30604 KiB
random_37.txt AC 158 ms 30632 KiB
random_38.txt AC 146 ms 30644 KiB
random_39.txt AC 148 ms 30636 KiB