304477: CF853E. Lada Malina
Memory Limit:256 MB
Time Limit:5 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Lada Malina
题意翻译
给出平面上 $n$ 个带权点 $f_i$,再给出 $k$ 个向量 $v_i$,每次询问给出一个点 $p$ 和一个值 $t$,求能满足 $f_i+∑w_jv_j=p$$(−t\le w_j \le t)$的 $f_i $ 的点权和。题目描述
After long-term research and lots of experiments leading Megapolian automobile manufacturer «AutoVoz» released a brand new car model named «Lada Malina». One of the most impressive features of «Lada Malina» is its highly efficient environment-friendly engines. Consider car as a point in $ Oxy $ plane. Car is equipped with $ k $ engines numbered from $ 1 $ to $ k $ . Each engine is defined by its velocity vector whose coordinates are $ (vx_{i},vy_{i}) $ measured in distance units per day. An engine may be turned on at any level $ w_{i} $ , that is a real number between $ -1 $ and $ +1 $ (inclusive) that result in a term of $ (w_{i}·vx_{i},w_{i}·vy_{i}) $ in the final car velocity. Namely, the final car velocity is equal to $ (w_{1}·vx_{1}+w_{2}·vx_{2}+...+w_{k}·vx_{k}, w_{1}·vy_{1}+w_{2}·vy_{2}+...+w_{k}·vy_{k}) $ Formally, if car moves with constant values of $ w_{i} $ during the whole day then its $ x $ -coordinate will change by the first component of an expression above, and its $ y $ -coordinate will change by the second component of an expression above. For example, if all $ w_{i} $ are equal to zero, the car won't move, and if all $ w_{i} $ are equal to zero except $ w_{1}=1 $ , then car will move with the velocity of the first engine. There are $ n $ factories in Megapolia, $ i $ -th of them is located in $ (fx_{i},fy_{i}) $ . On the $ i $ -th factory there are $ a_{i} $ cars «Lada Malina» that are ready for operation. As an attempt to increase sales of a new car, «AutoVoz» is going to hold an international exposition of cars. There are $ q $ options of exposition location and time, in the $ i $ -th of them exposition will happen in a point with coordinates $ (px_{i},py_{i}) $ in $ t_{i} $ days. Of course, at the «AutoVoz» is going to bring as much new cars from factories as possible to the place of exposition. Cars are going to be moved by enabling their engines on some certain levels, such that at the beginning of an exposition car gets exactly to the exposition location. However, for some of the options it may be impossible to bring cars from some of the factories to the exposition location by the moment of an exposition. Your task is to determine for each of the options of exposition location and time how many cars will be able to get there by the beginning of an exposition.输入输出格式
输入格式
The first line of input contains three integers $ k,n,q $ ( $ 2<=k<=10 $ , $ 1<=n<=10^{5} $ , $ 1<=q<=10^{5} $ ), the number of engines of «Lada Malina», number of factories producing «Lada Malina» and number of options of an exposition time and location respectively. The following $ k $ lines contain the descriptions of «Lada Malina» engines. The $ i $ -th of them contains two integers $ vx_{i} $ , $ vy_{i} $ ( $ -1000<=vx_{i},vy_{i}<=1000 $ ) defining the velocity vector of the $ i $ -th engine. Velocity vector can't be zero, i.e. at least one of $ vx_{i} $ and $ vy_{i} $ is not equal to zero. It is guaranteed that no two velosity vectors are collinear (parallel). Next $ n $ lines contain the descriptions of factories. The $ i $ -th of them contains two integers $ fx_{i} $ , $ fy_{i} $ , $ a_{i} $ ( $ -10^{9}<=fx_{i},fy_{i}<=10^{9} $ , $ 1<=a_{i}<=10^{9} $ ) defining the coordinates of the $ i $ -th factory location and the number of cars that are located there. The following $ q $ lines contain the descriptions of the car exposition. The $ i $ -th of them contains three integers $ px_{i} $ , $ py_{i} $ , $ t_{i} $ ( $ -10^{9}<=px_{i},py_{i}<=10^{9} $ , $ 1<=t_{i}<=10^{5} $ ) defining the coordinates of the exposition location and the number of days till the exposition start in the $ i $ -th option.
输出格式
For each possible option of the exposition output the number of cars that will be able to get to the exposition location by the moment of its beginning.
输入输出样例
输入样例 #1
2 4 1
1 1
-1 1
2 3 1
2 -2 1
-2 1 1
-2 -2 1
0 0 2
输出样例 #1
3
输入样例 #2
3 4 3
2 0
-1 1
-1 -2
-3 0 6
1 -2 1
-3 -7 3
3 2 2
-1 -4 1
0 4 2
6 0 1
输出样例 #2
4
9
0