Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- long long int t,n,i,j,k,w,first,count=0;
- cin>>t;
- for(k=1;k<=t;k++)
- {
- cin>>n>>w;
- long long int x[n+5],y[n+5];
- for(i=0;i<n;i++)
- cin>>x[i]>>y[i];
- sort(y,y+n);
- first=y[0];
- count=1;
- for(i=1;i<n;i++)
- {
- if(first+w<y[i])
- {
- first=y[i];
- count++;
- }
- }
- cout<<"Case "<<k<<": "<<count<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement