-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathREDALERT.cpp
More file actions
45 lines (42 loc) · 776 Bytes
/
REDALERT.cpp
File metadata and controls
45 lines (42 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/*
Codechef Problem Name: Red Alert
Codechef Problem Code: REDALERT
Codechef Problem Link: https://www.codechef.com/problems/REDALERT
*/
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
#include <vector>
using namespace std;
int main(){
int t;
cin >> t;
while(t--){
int n, d, h, u=0;
string ans = "NO";
cin>>n>>d>>h;
int A[n];
for(int i=0; i<n; i++){
cin >> A[i];
}
for(int j=0; j<n; j++){
if(A[j]>0){
u+=A[j];
}
else{
if(u<d){
u=0;
}
else{
u-=d;
}
}
if(u>h){
ans = "YES";
break;
}
}
cout << ans << endl;
}
return 0;
}