g | x | w | all
Bytes Lang Time Link
116Python250318T013851ZLucenapo
378Python3250317T014400Z3RR0R404

Python, 116 bytes

A={};I=int;input()
while x:=input().split():
 if I(x[0]):print(min(I(x[1])*I(a)+I(b)for a,b in A))
 else:A[*x[1:]]=1

Attempt This Online!

The integers a and b are bounded in size, so there is a maximum size for the dict (at most \$(2\times10^9+1)^2\$). This means the iterator in the third line has a bounded size. The multiplication and addition takes time logarithmic in \$n\$ (as x[1] is at most n for line 3) and there are at most \$q\$ such times where we have to multiply and add. The dict having a bounded size means the time for a dict insertion (in line 4) is constant. This means the total time is \$O(q\log(n))\$.

Python3 378 bytes

I=lambda:map(int,input().split())
n,q=I()
def h(a,b):
 def f(x):return a if x<0 else a*x+b
 return f
L=[h(1e9,1e9)]*-~n
def m(p,l=0,r=n):
 k=l+r>>1;v=L[k](p)
 if l<r:v=min(v,m(p,k+1,r)if p>k else m(p,l,k))
 return v
def i(f,l=0,r=n):
 k=l+r>>1
 if f(k)<L[k](k):L[k],f=f,L[k]
 l>=r or(f(-1)>L[k](-1)or i(f,k+1,r))and i(f,l,k)
while q:q-=1;t,*x=I();(t or i(h(*x)))and print(m(*x))

h returns a line given a, b, returns a if x<0

i inserts a line into a LCT in O(logn) time

m returns the minimum at p in O(logn) time

last line is the control segment, controlling whether i or m should be called

time complexity: O(qlogn+n)