-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathB.cpp
More file actions
46 lines (40 loc) · 865 Bytes
/
Copy pathB.cpp
File metadata and controls
46 lines (40 loc) · 865 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
46
//https://codeforces.com/contest/1238/problem/B
#include <bits/stdc++.h>
using namespace std;
void solve();
int main()
{
ios::sync_with_stdio(false); cin.tie(nullptr);
solve();
return 0;
}
void solve()
{
int q; cin >> q;
set<int> x;
int xi;
int fac = 0;
int out = 0;
for(int i = 0; i < q; ++i)
{
int n, r; cin >> n >> r;
for(int i = 0; i < n; ++i)
{
cin >> xi;
x.insert(-1 * xi);
}
fac = 0;
out = 0;
while (!x.empty())
{
set<int>::const_iterator itc = x.begin();
int c = -1 * (*itc);
x.erase(itc);
if (c - fac * r > 0)
{
out++; ++fac;
}
}
cout << out << endl;
}
}