QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#319329#5604. Triangle ContainmentchmproCompile Error//C++20609b2024-02-02 14:31:592024-02-02 14:32:00

Judging History

你现在查看的是最新测评结果

  • [2024-02-02 14:32:00]
  • 评测
  • [2024-02-02 14:31:59]
  • 提交

answer

import sys
input=sys.stdin.readline
F=lambda:[*map(int,input().split())]

N,X=F()
A=[]
for i in range(N):
  x,y,v=F()
  A.append((x,y,v,i)) #(x,y),가치,index
s1A=sorted(A,key=lambda a:a[0]/a[1])
s2A=sorted(A,key=lambda a:(a[0]-X)/a[1])
#print(A,s1A,s2A)
R2=[0]*N
for i in range(N):R2[s2A[i][3]]=i #A[i]는 2번째 기준으로 R2[i]등

SEGT=[0]*(2*N)
ANS=[0]*N
for _,_,v,i in s1A[::-1]:
  l=N;r=R2[i]+N
  while l<=r:
    if l%2==1:ANS[i]+=SEGT[l]
    if r%2==0:ANS[i]+=SEGT[r]
    l=(l+1)//2
    r=(r-1)//2
  p=R2[i]+N
  while p>=1:
    SEGT[p]+=v
    p>>=1
print(*ANS,sep='\n')

Details

answer.code:9:23: error: stray ‘#’ in program
    9 |   A.append((x,y,v,i)) #(x,y),가치,index
      |                       ^
answer.code:12:2: error: invalid preprocessing directive #print
   12 | #print(A,s1A,s2A)
      |  ^~~~~
answer.code:14:35: error: stray ‘#’ in program
   14 | for i in range(N):R2[s2A[i][3]]=i #A[i]는 2번째 기준으로 R2[i]등
      |                                   ^
answer.code:1:1: error: ‘import’ does not name a type
    1 | import sys
      | ^~~~~~
answer.code:1:1: note: C++20 ‘import’ only available with ‘-fmodules-ts’, which is not yet enabled with ‘-std=c++20’
answer.code:19:7: error: ‘r’ does not name a type
   19 |   l=N;r=R2[i]+N
      |       ^