QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#488627 | #3652. Antimatter Rain | chmpro | WA | 1400ms | 92180kb | Python3 | 1008b | 2024-07-24 12:13:30 | 2024-07-24 12:13:30 |
Judging History
answer
import bisect
import sys
input=sys.stdin.readline
F=lambda:[*map(int,input().split())]
INF=1<<60
N,M=F()
A=[F()for _ in range(N)]
B=[F()for _ in range(M)]
S=set()
for x,y in A:S.add(x)
S=sorted(S)
SN=len(S)
DIC={S[i]:i for i in range(SN)}
for i in range(N):A[i][0]=DIC[A[i][0]]
ST=[[]for _ in range(2*SN)]
VIS=[INF]*M
def upd(l,r,idx):
l+=SN; r+=SN
while l<=r:
if l&1==1:ST[l].append(idx)
if r&1==0:ST[r].append(idx)
l=l+1>>1; r=r-1>>1
def qry(p,y):
p+=SN; ret=-1
while p:
while ST[p] and VIS[ST[p][-1]]<y:ST[p].pop()
if ST[p] and H[ST[p][-1]]>H[ret]:ret=ST[p][-1]
p>>=1
VIS[ret]=y
return H[ret]
ANS=[0]*N
ID=[i for i in range(N)]
ID.sort(key=lambda x:A[x][1])
B.sort(key=lambda x:x[2])
H=[B[i][2] for i in range(M)]+[0]
j=0
for i in ID:
x,y=A[i]
while j<M and H[j]<y:
x1,x2,_=B[j]
l=bisect.bisect_left(S,x1)
r=bisect.bisect_right(S,x2)-1
upd(l,r,j)
j+=1
ANS[i]=qry(x,y)
print(*ANS,sep='\n')
詳細信息
Test #1:
score: 100
Accepted
time: 11ms
memory: 10720kb
input:
5 3 1 8 2 3 2 8 5 8 5 9 3 6 6 1 7 4 1 3 1
output:
4 1 4 6 0
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 14ms
memory: 10748kb
input:
6 3 1 2 4 8 5 10 6 10 7 10 8 10 1 1 1 3 4 3 5 7 9
output:
1 3 9 9 9 0
result:
ok 6 lines
Test #3:
score: 0
Accepted
time: 1392ms
memory: 92180kb
input:
100000 99848 461204923 637745978 730940613 102572682 422553731 879673851 959120803 991859511 66598648 437664322 968838882 853361367 807956510 415715356 293677855 629374884 112400753 480198913 759527413 731879157 888208396 962495575 378888480 976763956 86782568 830961763 104317977 910253192 599817862...
output:
637725292 102566084 879595382 991830068 437311948 853113431 415707097 628685428 480160596 731864107 962094102 976763930 830904381 910248454 652627393 807526651 705104190 675281954 214262587 797606430 0 640747989 580293039 191926114 651332622 634401276 582962011 871433879 0 268034028 330703413 298653...
result:
ok 100000 lines
Test #4:
score: 0
Accepted
time: 1395ms
memory: 91996kb
input:
100000 99628 577777925 801287929 37068709 326405410 634848495 7867761 869221913 643452536 749602674 814216198 971992064 530501551 56742331 138375983 652886967 950100618 556286686 606408066 464360884 994325977 276496200 853867831 245119123 766411254 168987406 558974142 724658430 990992666 626737492 8...
output:
801232824 0 7783790 642733981 814193564 0 0 950097246 606394309 994321901 853786329 766316681 558966994 990988962 887831443 87777120 736082434 0 886205140 238736749 852388096 900936749 0 0 721308490 836065791 0 232972673 473349858 475685732 0 170516794 713116881 819243501 820189458 25409240 18231941...
result:
ok 100000 lines
Test #5:
score: 0
Accepted
time: 1400ms
memory: 91836kb
input:
100000 99584 409045089 846398047 623469667 749163081 563263708 825732697 592536917 958727122 726870068 726112530 155555360 769747273 52857519 960819778 510933674 66393706 848718045 299105323 985334284 838528813 994493645 450107631 222352958 146061685 835040126 267566726 48234287 848576667 203587996 ...
output:
846386815 749112756 825623409 958714411 726058240 769325564 0 66390075 299102554 0 0 145933077 267545347 848558449 484998424 492115891 0 906078271 834469882 115200500 598572594 0 0 865353284 111179779 935989913 252529213 508179704 0 342376316 0 449465845 0 286515197 864414095 869316420 907349300 302...
result:
ok 100000 lines
Test #6:
score: 0
Accepted
time: 762ms
memory: 85292kb
input:
100000 99445 582948436 892030017 748511441 701710818 604686594 2428156 173692569 609536839 365550651 584192841 575478113 135169773 659643019 942891139 167985867 967510613 471217789 403239280 525832649 399186100 846150529 131828663 256396173 760060348 971491942 327460761 713581298 877945574 699566552...
output:
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 275680643 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 78748259 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 77623426 0 0 0 0 0 0 0 203210308 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ...
result:
ok 100000 lines
Test #7:
score: 0
Accepted
time: 12ms
memory: 10708kb
input:
1 1 1 1 2 3 1
output:
0
result:
ok single line: '0'
Test #8:
score: 0
Accepted
time: 11ms
memory: 10780kb
input:
1 1 10 10 1 20 11
output:
0
result:
ok single line: '0'
Test #9:
score: 0
Accepted
time: 14ms
memory: 10688kb
input:
1 1 1 1000000000 1 1 1
output:
1
result:
ok single line: '1'
Test #10:
score: 0
Accepted
time: 482ms
memory: 53696kb
input:
100000 99916 72 62419148 79 823829294 18 88494113 46 871073433 87 427382271 96 407586625 84 773031476 51 21249629 14 294418533 41 246065011 2 944467317 38 213355833 20 518401363 5 853074481 63 887282992 34 826180337 71 301722994 96 816300426 75 638767975 30 27543615 94 678436491 33 10183343 85 14029...
output:
61664018 823825259 88209205 871019573 0 406926630 772682402 21243865 294413011 246001978 0 213095040 518372986 0 887150326 825535683 300463464 816066353 638687721 27529070 678371462 10153084 137839746 124880643 580618290 91171192 515212354 118685662 146816880 823451240 153281701 890930074 0 78656698...
result:
ok 100000 lines
Test #11:
score: -100
Wrong Answer
time: 519ms
memory: 53636kb
input:
100000 99395 88 47602564 19 690291775 86 287729214 63 667638689 91 318396869 87 476716206 78 578558092 37 609634124 79 117926393 73 370677765 20 667873894 40 584211668 90 629644956 25 174654454 9 790131584 5 700791228 63 863931112 44 166393948 32 314913481 14 474683302 20 164907908 70 965550575 11 2...
output:
44628155 690176822 282718983 667634802 318379148 476713556 578550325 609565996 117896066 370663045 667858374 584211478 0 174653186 790125978 700617964 863794465 166360469 314906605 474664426 164882016 965519867 0 407716559 0 620410635 709144202 414483226 76922779 689610083 195178545 19259702 3369546...
result:
wrong answer 15474th lines differ - expected: '999906038', found: '999849037'