A11258 | Lada Malina
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
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.
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.
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
Images describing sample tests are given below. Exposition options are denoted with crosses, factories are denoted with points. Each factory is labeled with a number of cars that it has.
First sample test explanation:
- Car from the first factory is not able to get to the exposition location in time.
- Car from the second factory can get to the exposition in time if we set $w_{1}=0$ , $w_{2}=1$ .
- Car from the third factory can get to the exposition in time if we set , .
- Car from the fourth factory can get to the exposition in time if we set $w_{1}=1$ , $w_{2}=0$ .

First sample test explanation:
- Car from the first factory is not able to get to the exposition location in time.
- Car from the second factory can get to the exposition in time if we set $w_{1}=0$ , $w_{2}=1$ .
- Car from the third factory can get to the exposition in time if we set , .
- Car from the fourth factory can get to the exposition in time if we set $w_{1}=1$ , $w_{2}=0$ .

C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted