-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path1016 - Brush (II).cpp
47 lines (45 loc) · 1.03 KB
/
1016 - Brush (II).cpp
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
#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define EPS 0.00000001
#define PI 2*acos(0.0)
#define ck(XX) cout<<XX<<endl
#define set(XX,POS) XX|(1<<POS)
#define reset(XX,POS) XX&(~(1<<POS))
#define check(XX,POS) (bool)(XX&(1<<POS))
#define toggle(XX,POS) (XX^(1<<POS))
#define Fin freopen("input.txt","r",stdin)
#define Fout freopen("output.txt","w",stdout)
#define MS(ARRAY,VALUE) memset(ARRAY,VALUE,sizeof(ARRAY))
#define RT printf("Run Time : %0.3lf seconds\n", clock()/(CLOCKS_PER_SEC*1.0))
vector<LL>v;
int main()
{
int tc,cn=0;
cin >> tc;
while(tc--)
{
int n,w;
LL a,b;
cin>>n>>w;
for(int i=0;i<n;i++)
{
cin>>a>>b;
v.push_back(b);
}
sort(v.begin(),v.end());
int ans=1;
a=v[0];
for(int i=1; i<n; i++)
{
if(v[i]-a>w)
{
ans++;
a=v[i];
}
}
printf("Case %d: %d\n",++cn,ans);
v.clear();
}
return 0;
}