-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjuly_lunch_3.cpp
More file actions
49 lines (49 loc) · 816 Bytes
/
july_lunch_3.cpp
File metadata and controls
49 lines (49 loc) · 816 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
47
48
49
#include<iostream>
#include<algorithm>
#include<string.h>
#define ll long long int
using namespace std;
ll search(ll a[],ll high,ll val,ll low)
{
ll l=low,h=high;
for(ll i=l;i<h;i++)
if(a[i]>=val)
return i;
return -1;
}
int main()
{
ll a[300000],no,n,i,j,k,c;
bool v[300000];
cin>>no;
while(no--)
{
cin>>n>>k>>c;
memset(v,0,sizeof(v));
for(i=0;i<n;i++)
cin>>a[i];
sort(a,a+n);
ll count=0;
for(i=0;i<n;i++)
{
if(v[i])
continue;
else{
for(j=i;j<n;)
{
ll ind=search(a,n,a[j]*c+1,j);
if(ind>0&&v[ind]==0){
j=ind;
v[j]=1;
}
else{
count++;
break;
}
}
}
}
cout<<count<<endl;
}
return 0;
}