Submission #69313624
Source Code Expand
from heapq import heappop, heappush N, K = map(int, input().split()) h = [] ans = [] rest = K tp = 0 for _ in range(N): a, b, c = map(int, input().split()) a = max(tp, a) while h: t, v = h[0] if t <= a: heappop(h) rest += v elif rest < c: heappop(h) rest += v a = t else: break rest -= c ans.append(a) tp = a heappush(h, (a + b, c)) print(*ans, sep="\n")
Submission Info
Submission Time | |
---|---|
Task | D - Long Waiting |
User | mo12412 |
Language | Python (PyPy 3.10-v7.3.12) |
Score | 400 |
Code Size | 518 Byte |
Status | AC |
Exec Time | 373 ms |
Memory | 127224 KiB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt |
All | 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00-sample-01.txt | AC | 63 ms | 76712 KiB |
00-sample-02.txt | AC | 62 ms | 76652 KiB |
00-sample-03.txt | AC | 63 ms | 76416 KiB |
01-01.txt | AC | 171 ms | 90188 KiB |
01-02.txt | AC | 290 ms | 111236 KiB |
01-03.txt | AC | 133 ms | 90436 KiB |
01-04.txt | AC | 130 ms | 89728 KiB |
01-05.txt | AC | 373 ms | 127224 KiB |
01-06.txt | AC | 342 ms | 122132 KiB |
01-07.txt | AC | 147 ms | 87920 KiB |
01-08.txt | AC | 370 ms | 124872 KiB |
01-09.txt | AC | 309 ms | 110220 KiB |
01-10.txt | AC | 324 ms | 111800 KiB |
01-11.txt | AC | 304 ms | 110960 KiB |
01-12.txt | AC | 309 ms | 111932 KiB |
01-13.txt | AC | 311 ms | 111992 KiB |
01-14.txt | AC | 275 ms | 109032 KiB |