Submission #4030285


Source Code Expand

n,c=map(int,input().split())
l=[list(map(int,input().split())) for i in range(n)]

rev=[None]*(n+1)
norm=[None]*(n+1)
rev[0]=(0,0)
norm[0]=(0,0)
ans=0

# normal rotation
for i in range(1,n+1):
    x,v=l[i-1]
    norm[i]=(x,v+norm[i-1][1])

# reverse rotation
for i in range(1,n+1)[::-1]:
    x,v=l[i-1]
    if i==n:
        rev[i]=(c-x,v)
    else:
        rev[i]=(c-x,v+rev[i+1][1])

for i in range(n+1):
    for j in range(n-i+1):
        cost=min(norm[i][0]+2*rev[-j][0],2*norm[i][0]+rev[-j][0])
        ans=max(ans,rev[-j][1]+norm[i][1]-cost)

print(ans)

Submission Info

Submission Time
Task D - Static Sushi
User tallestorange
Language Python (3.4.3)
Score 300
Code Size 585 Byte
Status TLE
Exec Time 2107 ms
Memory 54724 KB

Judge Result

Set Name Sample Subtask1 Subtask2
Score / Max Score 0 / 0 300 / 300 0 / 200
Status
AC × 4
AC × 29
AC × 31
TLE × 19
Set Name Test Cases
Sample a01, a02, a03, a04
Subtask1 a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29
Subtask2 a01, a02, a03, a04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, c30, c31, c32, c33, c34, c35, c36, c37, c38, c39, c40, c41, c42, c43, c44, c45, c46, c47, c48, c49, c50
Case Name Status Exec Time Memory
a01 AC 18 ms 3064 KB
a02 AC 18 ms 3064 KB
a03 AC 18 ms 3064 KB
a04 AC 18 ms 3064 KB
b05 AC 18 ms 3064 KB
b06 AC 18 ms 3064 KB
b07 AC 18 ms 3064 KB
b08 AC 18 ms 3064 KB
b09 AC 24 ms 3064 KB
b10 AC 24 ms 3064 KB
b11 AC 24 ms 3064 KB
b12 AC 24 ms 3064 KB
b13 AC 24 ms 3064 KB
b14 AC 23 ms 3064 KB
b15 AC 24 ms 3064 KB
b16 AC 24 ms 3064 KB
b17 AC 24 ms 3064 KB
b18 AC 24 ms 3064 KB
b19 AC 25 ms 3064 KB
b20 AC 24 ms 3064 KB
b21 AC 24 ms 3064 KB
b22 AC 20 ms 3064 KB
b23 AC 19 ms 3064 KB
b24 AC 18 ms 3064 KB
b25 AC 24 ms 3064 KB
b26 AC 18 ms 3064 KB
b27 AC 24 ms 3064 KB
b28 AC 24 ms 3064 KB
b29 AC 24 ms 3064 KB
c30 TLE 2106 ms 47976 KB
c31 TLE 2107 ms 52776 KB
c32 TLE 2107 ms 52672 KB
c33 TLE 2106 ms 54720 KB
c34 TLE 2107 ms 52672 KB
c35 TLE 2106 ms 47976 KB
c36 TLE 2107 ms 52672 KB
c37 TLE 2106 ms 54724 KB
c38 TLE 2107 ms 52676 KB
c39 TLE 2107 ms 52676 KB
c40 TLE 2107 ms 52676 KB
c41 TLE 2107 ms 52680 KB
c42 TLE 2107 ms 52680 KB
c43 TLE 2104 ms 7924 KB
c44 TLE 2107 ms 52680 KB
c45 AC 625 ms 3444 KB
c46 TLE 2107 ms 52684 KB
c47 AC 25 ms 3064 KB
c48 TLE 2107 ms 52676 KB
c49 TLE 2107 ms 52676 KB
c50 TLE 2107 ms 52684 KB