Submission #4423352


Source Code Expand

Copy
N = int(input())
L = []
for i in range(N):
  L.append(list(map(int,input().split())))
dp_a = [L[0][0]]
dp_b = [L[0][1]]
dp_c = [L[0][2]]
for i in range(N-1):
  dp_a.append(max(dp_b[i]+L[i+1][0],dp_c[i]+L[i+1][0]))
  dp_b.append(max(dp_a[i]+L[i+1][1],dp_c[i]+L[i+1][1]))
  dp_c.append(max(dp_a[i]+L[i+1][2],dp_b[i]+L[i+1][2]))
print(max(dp_a[N-1],dp_b[N-1],dp_c[N-1]))

Submission Info

Submission Time
Task C - Vacation
User Syuko4omi
Language Python3 (3.4.3)
Score 100
Code Size 378 Byte
Status
Exec Time 575 ms
Memory 42504 KB

Test Cases

Set Name Score / Max Score Test Cases
All 100 / 100 0_00, 0_01, 0_02, 1_00, 1_01, 1_02, 1_03, 1_04, 1_05, 1_06, 1_07, 1_08, 1_09
Case Name Status Exec Time Memory
0_00 18 ms 3064 KB
0_01 18 ms 3064 KB
0_02 18 ms 3064 KB
1_00 18 ms 3064 KB
1_01 561 ms 42504 KB
1_02 575 ms 42264 KB
1_03 545 ms 42004 KB
1_04 550 ms 42280 KB
1_05 567 ms 41852 KB
1_06 553 ms 42300 KB
1_07 553 ms 41856 KB
1_08 548 ms 41792 KB
1_09 544 ms 41896 KB