Sicily 13295. Kingdom Rush I
来源:互联网 发布:中文翻译缅甸语软件 编辑:程序博客网 时间:2024/05/19 05:06
13295. Kingdom Rush I
Constraints
Time Limit: 1 secs, Memory Limit: 256 MB
Description
Kingdom Rush is a popular TD game, in which you should build some towers to protect your kingdom from monsters. And now a new wave of monsters is coming and you need to know whether you can get through it.
To simplify this problem, the path of monsters is a straight line, and there are N blocks on it (numbered from 1 to N continuously). Before enemies come, you have M towers built. Each tower has an attack range [L, R], meaning that it can attack all enemies in every block i where L<=i<=R. Besides, each monster comes from block 1 and go straightly to block N. Once a monster steps into block i, every tower whose attack range include block i will attack the monster once and only once. For example, a tower with attack range [1, 3] will attack a monster three times if the monster is alive, one in block 1 , another in block 2 and the last in block 3.
Now that you know each monster has HP Hi and each tower has a value of attack Di, one attack will cause Di damage (decrease HP by Di). If the HP of a monster is decreased to 0, it will die and disappear.
Your task is to calculate the number of monsters surviving from your towers so as to make a plan B.
Input
The first line of the input is a number N, the number of blocks in the path. (0 < N <= 10^9)
The second line is a number M, the number of towers you have. (0 < M <= 10000)
The next M line, the ith (1 <= i <= M) line contains three numbers, Li , Ri, Di, the attack range [L,R] and the value of attack D of the ith tower. (1 <= Li <= Ri <= N, 0 < Di <= 1000)
The next line is a number K, the number of coming monsters. (0 < K <= 10000)
The last line contains K numbers Hi, live point of each monster. (0 < Hi <= 10^18)
Output
Output one line containing the number of surviving monsters.
Sample Input
521 3 15 5 251 3 5 7 9
Sample Output
2
Hint
In the sample, two monsters with origin HP 7 and 9 will survive.
Problem Source
"6CIT杯"第五届中山大学ICPC新手赛 by 莫益阶
// Problem#: 13295// Submission#: 3560624// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/// All Copyright reserved by Informatic Lab of Sun Yat-sen University#include <stdio.h>int main() { long long N, M, sum = 0, st, ed, da, K, H, ans = 0; scanf("%lld%lld", &N, &M); while (M--) { scanf("%lld%lld%lld", &st, &ed, &da); sum += (ed - st + 1) * da; } scanf("%lld", &K); while (K--) { scanf("%lld", &H); if (H > sum) ans++; } printf("%lld\n", ans); return 0;}
- Sicily 13295. Kingdom Rush I
- Sicily 13296. Kingdom Rush II
- Kingdom Rush游戏介绍
- 破解Kingdom Rush:Frontiers
- Kingdom Rush 国王保卫战图文攻略
- Kingdom Rush 国王保卫战 全箭塔通关
- Kingdom Rush 国王保卫战策略心得
- 【贪心】GCJ 2012 round1A kingdom rush
- Sicily 1796. Max's kingdom
- Sicily 1796. Max's kingdom
- Sicily 1796. Max's kingdom
- Kingdom Rush创始人专访:游戏与电影元素混搭
- 基于Windows Form的kingdom rush 塔防游戏设计与实现
- Sicily.1004. I Conduit!
- Sicily 1004. I Conduit!
- Sicily 1004 I Conduit!
- Sicily 1004. I Conduit!
- sicily 1004.I Conduit!
- EL表达式
- nyoj 264 国王的魔镜
- Linux环境下VI/VIM编辑文件时无权限保存的解决方法
- Sicily 13296. Kingdom Rush II
- Python读写Excel
- Sicily 13295. Kingdom Rush I
- 《Effective C++ 改善程序与设计的55个具体做法》——第一章笔记
- Linux升级Python
- Sicily 1220. 破译密文
- 动态申请内存new和malloc的区别
- Received error packet: errno = 1236, sqlstate = HY000 errmsg = Slave can not handle replication even
- CF 2014 ACM-ICPC Vietnam National Second Round C. ATM withdrawal
- Android仿微信底部菜单栏+顶部菜单栏
- 将一个数字字符串转换成该字符串对应的数字(包括正整数、负整数)