Submission #19724422


Source Code Expand

Copy
N, C = map(int, input().split())
a = [0] * N
b = [0] * N
c = [0] * N
for i in range(N):
    a[i], b[i], c[i] = map(int, input().split())

data=[]
for i in range(N):
    data.append([a[i]-1,c[i]])
    data.append([b[i],-c[i]])
data2 = sorted(data)

ans=0
t=0
fee=0
for x, y in data2:
    #print(x,y,t,fee,ans)
    if x != t:
        ans += min(C,fee)*(x-t)
        t=x
    fee += y
    #print(x,y,t,fee,ans)
print(ans)

Submission Info

Submission Time
Task D - Snuke Prime
User BSchlink
Language Python (3.8.2)
Score 400
Code Size 442 Byte
Status AC
Exec Time 1866 ms
Memory 84740 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 3
AC × 28
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All 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, sample_01.txt, sample_02.txt, sample_03.txt
Case Name Status Exec Time Memory
random_01.txt AC 28 ms 8972 KB
random_02.txt AC 24 ms 8848 KB
random_03.txt AC 21 ms 8860 KB
random_04.txt AC 23 ms 8960 KB
random_05.txt AC 19 ms 8848 KB
random_06.txt AC 20 ms 8956 KB
random_07.txt AC 22 ms 9040 KB
random_08.txt AC 24 ms 8856 KB
random_09.txt AC 27 ms 8928 KB
random_10.txt AC 18 ms 8844 KB
random_11.txt AC 26 ms 9064 KB
random_12.txt AC 19 ms 8860 KB
random_13.txt AC 25 ms 8976 KB
random_14.txt AC 21 ms 8844 KB
random_15.txt AC 19 ms 8848 KB
random_16.txt AC 424 ms 29500 KB
random_17.txt AC 919 ms 50848 KB
random_18.txt AC 813 ms 45256 KB
random_19.txt AC 704 ms 42428 KB
random_20.txt AC 1842 ms 83864 KB
random_21.txt AC 1275 ms 63648 KB
random_22.txt AC 118 ms 15668 KB
random_23.txt AC 1850 ms 84552 KB
random_24.txt AC 1866 ms 84740 KB
random_25.txt AC 778 ms 71288 KB
sample_01.txt AC 25 ms 8928 KB
sample_02.txt AC 19 ms 9072 KB
sample_03.txt AC 25 ms 8816 KB