DOTAA  DOTA HEROES
DOTA HEROES
Problem Description:
Defence Of The Ancients(DOTA) is one of the most addictive online multiplayer games. There are n heroes in our team and our motto is to conquer the opponent’s empire. To safeguard their empire, the opponents had constructed m towers on the path. If one or more heroes get into the sight of a tower, then the tower does D amount of damage to one of those heroes at that instant (i.e. one of the heroes’ health decreases by D). Any hero will die if his health H <=0. Once a tower attacks one of the heroes at that instant, all of those at that instant get out of its sight. Find whether all of the heroes in our team can reach the opponent’s empire alive.
Input Specification:
The first line consists of one integer t representing the number of test cases. For each test case, the first line consists of three integers n, m and D, the number of heroes, number of towers and the amount of Damage respectively. The next n lines consist of an integer representing the health of respective hero.
Output Specification:
Just a word “YES” if we can reach the opponent’s empire alive, else “NO”.
Input Constraints:
1 <= t <= 500
1 <= n <= 500
1 <= m <= n
1 <= D, H <= 20000
Sample Input:
3 6 3 400 500 500 500 500 500 500 6 5 400 800 800 801 200 200 200 6 3 400 401 401 400 200 400 200
Sample Output:
YES NO NO
Explanation of test case 1:
One of the possible solutions is
First, three of the heroes can goes together. One of them receives 400 damage from the first tower and all of them cross it. Then while crossing the next tower, one of the heroes who is at 500 health gets 400 damage and all of them cross it. Then the third hero receives the damage when crossing the last tower. Similarly the other 3 heroes can reach the opponent’s base together without dying.
hide comments
mohit_11615192:
20181227 20:51:29
silly mistake "\n" after printing yes or no 

masterchef2209:
20180811 11:35:56
easy peasy with [spoiler] Last edit: 20180822 15:54:06 

pigpork:
20180626 03:29:06
I am done for! :') 

prince_jain:
20180616 15:13:14
Don't waste your time in solving this meaningless question 

kuchnahiaata:
20180401 23:14:01
Read @sobriquet's comment if you think your solution is right and still getting WA 

karthik1997:
20171228 20:20:11
Cases are too weak . My code with the 2nd case answer as YES is accepted by it , which should be NO :( . 

ayushgupta1997:
20171216 20:57:05
I first tried O(m*logn) soln but it gave tle so i come up with O(1) soln ,feeling confident nice problem for building confidence :D 

hitesh87:
20171214 16:36:47
Easy!!!


coder_harshad:
20171022 21:09:38
Note : In the actual test file the test cases do not end with a blank line. As they do in the sample test case provided! 

kullsno2:
20171018 17:36:40
AC in one GO! 
Added by:  cegprakash 
Date:  20111225 
Time limit:  0.208s 
Source limit:  50000B 
Memory limit:  1536MB 
Cluster:  Cube (Intel G860) 
Languages:  All except: ASM64 