Submission #59587997


Source Code Expand

Copy
from heapq import *
Q = int(input())
que = []
day = 0
for _ in range(Q):
line = input().split()
if line[0] == '1':
heappush(que, day)
elif line[0] == '2':
day += int(line[1])
else:
h = -1 * int(line[1]) + day
# print(que,day,line[1],h)
ans = 0
while(que):
if que[0] <= h:
heappop(que)
ans += 1
else:
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
from heapq import *

Q = int(input())
que = []
day = 0
for _ in range(Q):
    line = input().split()
    if line[0] == '1':
       heappush(que, day) 
    elif line[0] == '2':
        day += int(line[1])
    
    else:
        h = -1 * int(line[1]) + day
       # print(que,day,line[1],h)
        ans = 0
        while(que):
            if que[0] <= h:
                heappop(que)
                ans += 1
            else:
                break
        print(ans)

Submission Info

Submission Time
Task D - Home Garden
User QWERTOP18
Language Python (PyPy 3.10-v7.3.12)
Score 400
Code Size 489 Byte
Status AC
Exec Time 347 ms
Memory 85912 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 30
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 02_hand_00.txt, 02_hand_01.txt, 02_hand_02.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 59 ms 76480 KB
00_sample_01.txt AC 59 ms 76404 KB
01_random_00.txt AC 185 ms 84332 KB
01_random_01.txt AC 210 ms 84144 KB
01_random_02.txt AC 200 ms 84140 KB
01_random_03.txt AC 177 ms 83840 KB
01_random_04.txt AC 147 ms 84456 KB
01_random_05.txt AC 213 ms 84312 KB
01_random_06.txt AC 167 ms 84960 KB
01_random_07.txt AC 173 ms 83892 KB
01_random_08.txt AC 150 ms 84516 KB
01_random_09.txt AC 96 ms 83336 KB
01_random_10.txt AC 177 ms 84324 KB
01_random_11.txt AC 136 ms 83636 KB
01_random_12.txt AC 210 ms 83640 KB
01_random_13.txt AC 213 ms 84244 KB
01_random_14.txt AC 153 ms 84444 KB
01_random_15.txt AC 173 ms 84568 KB
01_random_16.txt AC 147 ms 84080 KB
01_random_17.txt AC 208 ms 84328 KB
01_random_18.txt AC 179 ms 84456 KB
01_random_19.txt AC 206 ms 84056 KB
01_random_20.txt AC 236 ms 84228 KB
01_random_21.txt AC 246 ms 85912 KB
01_random_22.txt AC 235 ms 84784 KB
01_random_23.txt AC 233 ms 83916 KB
01_random_24.txt AC 228 ms 84336 KB
02_hand_00.txt AC 347 ms 83100 KB
02_hand_01.txt AC 123 ms 82768 KB
02_hand_02.txt AC 123 ms 82712 KB


2025-04-15 (Tue)
06:49:56 +00:00