-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeforces1238B.cpp
More file actions
41 lines (40 loc) · 868 Bytes
/
Codeforces1238B.cpp
File metadata and controls
41 lines (40 loc) · 868 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
#include<bits/stdc++.h>
using namespace std;
typedef long long int ll;
#define pb push_back
#define pf push_front
#define ppb pop_back
#define ppf pop_front
#define speedforce ios_base::sync_with_stdio(0),cin.tie(0);
int main()
{
speedforce
int i,j,n,x,y,t,r,k;
scanf("%d",&t);
for(i=0;i<t;i++)
{
scanf("%d %d",&n,&r);
map<int,int>a;
vector<int>b;
for(j=0;j<n;j++)
{
scanf("%d",&x);
a[x]=1;
}
for(auto it=a.begin();it!=a.end();it++)
{
b.pb(it->first);
}
sort(b.begin(),b.end());
k=0;
int sum=0,cnt=0;
for(j=b.size()-1;j>=0;j--)
{
sum=b[j]+k;
if(sum<=0) break;
k-=r;
cnt++;
}
printf("%d\n",cnt);
}
}