Submission #67302711
Source Code Expand
Copy
from collections import dequeQ=int(input())q=deque()for _ in range(Q):t,*A=map(int, input().split())if t==1:c,x=Aq.append((x,c))else:k=A[0]ans=0while k>0:v,cnt=q.popleft()if cnt<=k:ans +=v*cntk-=cntelse:ans+=v*kq.appendleft((v,cnt-k))
from collections import deque Q=int(input()) q=deque() for _ in range(Q): t,*A=map(int, input().split()) if t==1: c,x=A q.append((x,c)) else: k=A[0] ans=0 while k>0: v,cnt=q.popleft() if cnt<=k: ans +=v*cnt k-=cnt else: ans+=v*k q.appendleft((v,cnt-k)) k=0 print(ans)
Submission Info
Submission Time | |
---|---|
Task | C - Large Queue |
User | kotafuku |
Language | Python (PyPy 3.10-v7.3.12) |
Score | 300 |
Code Size | 469 Byte |
Status | AC |
Exec Time | 413 ms |
Memory | 90692 KiB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt |
All | 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_test_00.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 01_test_19.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_00.txt | AC | 67 ms | 76924 KiB |
00_sample_01.txt | AC | 68 ms | 76928 KiB |
00_sample_02.txt | AC | 67 ms | 76752 KiB |
01_test_00.txt | AC | 83 ms | 81084 KiB |
01_test_01.txt | AC | 96 ms | 84188 KiB |
01_test_02.txt | AC | 93 ms | 83892 KiB |
01_test_03.txt | AC | 70 ms | 76660 KiB |
01_test_04.txt | AC | 272 ms | 85476 KiB |
01_test_05.txt | AC | 234 ms | 85032 KiB |
01_test_06.txt | AC | 297 ms | 86024 KiB |
01_test_07.txt | AC | 132 ms | 84656 KiB |
01_test_08.txt | AC | 272 ms | 85744 KiB |
01_test_09.txt | AC | 134 ms | 84796 KiB |
01_test_10.txt | AC | 301 ms | 87280 KiB |
01_test_11.txt | AC | 339 ms | 85220 KiB |
01_test_12.txt | AC | 334 ms | 88420 KiB |
01_test_13.txt | AC | 413 ms | 89120 KiB |
01_test_14.txt | AC | 409 ms | 88844 KiB |
01_test_15.txt | AC | 325 ms | 88996 KiB |
01_test_16.txt | AC | 176 ms | 90692 KiB |
01_test_17.txt | AC | 177 ms | 90488 KiB |
01_test_18.txt | AC | 68 ms | 76500 KiB |
01_test_19.txt | AC | 313 ms | 87708 KiB |