-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1200B.cpp
More file actions
63 lines (61 loc) · 1.72 KB
/
1200B.cpp
File metadata and controls
63 lines (61 loc) · 1.72 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include<bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp> // Common file
//#include <ext/pb_ds/tree_policy.hpp> // Including tree_order_statistics_node_update
#define int long long
#define mod 1000000007
#define maxN 1000001
#define pb push_back
#define mp make_pair
#define pii pair<int,int>
#define pip pair<int,pii>
#define vi vector<int>
#define vpi vector<pii >
#define endl
#define fastIO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)
#define FOR(a,b,c) for(int(a) = b;a<=c;a++)
#define repr(a,b,c) for(int(a) = b;a>=c;a--)
#define rep(i,n) for(int(i) = 0;i<n;i++)
#define fir first
#define sec second
#define beg begin()
#define e end()
#define len length()
using namespace std;
//using namespace __gnu_pbds;
const int inf = 0x3f3f3f3f3f3f3f3fll;
//typedef tree<int,null_type,less<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_set;
//typedef tree<int,null_type,less_equal<int>,rb_tree_tag,tree_order_statistics_node_update> ordered_multiset;
main(){
fastIO;
int t;
cin>>t;
while(t--){
int n,m,k;
cin>>n>>m>>k;
int a[n];
for(int i=0;i<n;i++)cin>>a[i];
m++;
int f=1;
FOR(i,0,n-1){
int f1=1;
if(abs(a[i]-a[i+1])<k){
if(m){
if(abs(a[i]+1-a[i+1])>=k){
f1=0;
m--;
continue;
}
}
cout<<a[i]<<" "<<a[i+1]<<" "<<m<<"\n";
cout<<"NO\n";
f=0;
break;
}
if(f1)
m++;
}
if(f){
cout<<"YES\n";
}
}
}