Result: Accepted
Time: 1031ms
Memory: 27084kB
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
#include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#define MAXN 100005
#define MOD 1e9+7
using namespace std;
typedef long long ll;
int n,k;
ll a[MAXN];
int main()
{
int i,j;
scanf("%d%d",&n,&k);
for(i=0;i<n;i++)
scanf("%lld",&a[i]);
vector<ll>v;
for(i=1;i<=k;i++)
{
for(j=0;j<n;j++)
if(a[j]%i==0)
v.push_back(1ll*a[j]/i);
}
sort(v.begin(),v.end());
ll time=1,maxt=1;
for(i=1;i<v.size();i++)
{
if(v[i]==v[i-1])
{
time++;
if(time>maxt)
maxt=time;
}else
time=1;
}
printf("%lld",maxt);
return 0;
}