A12952 | Jumping Transformers
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
You, the mighty Blackout, are standing in the upper-left $(0,0)$ corner of $N$ x $M$ matrix. You must move either right or down each second.
There are $K$ transformers jumping around the matrix in the following way. Each transformer starts jumping from position $(x,y)$ , at time $t$ , and jumps to the next position each second. The $x$ -axes grows downwards, and $y$ -axes grows to the right. The order of jumping positions is defined as ${(x,y),(x+d,y-d),(x+d,y),(x,y+d)}$ , and is periodic. Before time $t$ transformer is not in the matrix.
You want to arrive to the bottom-right corner $(N-1,M-1)$ , while slaying transformers and losing the least possible amount of energy. When you meet the transformer (or more of them) in the matrix field, you must kill them all, and you lose the sum of the energy amounts required to kill each transformer.
After the transformer is killed, he of course stops jumping, falls into the abyss and leaves the matrix world. Output minimum possible amount of energy wasted.
There are $K$ transformers jumping around the matrix in the following way. Each transformer starts jumping from position $(x,y)$ , at time $t$ , and jumps to the next position each second. The $x$ -axes grows downwards, and $y$ -axes grows to the right. The order of jumping positions is defined as ${(x,y),(x+d,y-d),(x+d,y),(x,y+d)}$ , and is periodic. Before time $t$ transformer is not in the matrix.
You want to arrive to the bottom-right corner $(N-1,M-1)$ , while slaying transformers and losing the least possible amount of energy. When you meet the transformer (or more of them) in the matrix field, you must kill them all, and you lose the sum of the energy amounts required to kill each transformer.
After the transformer is killed, he of course stops jumping, falls into the abyss and leaves the matrix world. Output minimum possible amount of energy wasted.
输入格式
In the first line, integers $N$ , $M$ ( $1 \leq N, M \leq 500$ ), representing size of the matrix, and $K$ ( $0 \leq K \leq 5*10^5$ ) , the number of jumping transformers.
In next $K$ lines, for each transformer, numbers $x$ , $y$ , $d$ ( $d \geq 1$ ), $t$ ( $0 \leq t \leq N+M-2$ ), and $e$ ( $0 \leq e \leq 10^9$ ), representing starting coordinates of transformer, jumping positions distance in pattern described above, time when transformer starts jumping, and energy required to kill it.
It is guaranteed that all 4 of jumping points of the transformers are within matrix coordinates
In next $K$ lines, for each transformer, numbers $x$ , $y$ , $d$ ( $d \geq 1$ ), $t$ ( $0 \leq t \leq N+M-2$ ), and $e$ ( $0 \leq e \leq 10^9$ ), representing starting coordinates of transformer, jumping positions distance in pattern described above, time when transformer starts jumping, and energy required to kill it.
It is guaranteed that all 4 of jumping points of the transformers are within matrix coordinates
输出格式
Print single integer, the minimum possible amount of energy wasted, for Blackout to arrive at bottom-right corner.
输入输出样例
输入 #1
3 3 5 0 1 1 0 7 1 1 1 0 10 1 1 1 1 2 1 1 1 2 2 0 1 1 2 3
输出 #1
9
If Blackout takes the path from (0, 0) to (2, 0), and then from (2, 0) to (2, 2) he will need to kill the first and third transformer for a total energy cost of 9. There exists no path with less energy value.
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted