import
java.util.*;
public
class
EncryptionValidity
{
public
static
List<Integer> encryptionValidity(
int
instructCount,
int
validPeriod, List<Integer> keys)
{
Map<Integer, Integer> mp =
new
HashMap<>();
int
maxi =
0
;
for
(
int
i : keys)
{
mp.put(i, mp.getOrDefault(i,
0
) +
1
);
}
for
(
int
i =
0
; i < keys.size(); i++)
{
int
num = keys.get(i);
int
count =
0
;
for
(
int
j =
1
; j <= Math.sqrt(num); j++)
{
if
(num % j ==
0
)
{
if
(mp.containsKey(j))
{
count += mp.get(j);
}
if
(j != num / j && mp.containsKey(num / j))
{
count += mp.get(num / j);
}
}
}
maxi = Math.max(count, maxi);
}
long
var = (
long
) instructCount * validPeriod;
if
(var >= maxi *
100000
)
{
return
Arrays.asList(
1
, (
int
) (maxi *
100000
));
}
return
Arrays.asList(
0
, (
int
) (maxi *
100000
));
}
public
static
void
main(String[] args) {
int
instructCount, validPeriod, n;
instructCount =
1000
;
validPeriod =
10000
;
n =
4
;
List<Integer> keys = Arrays.asList(
2
,
4
,
8
,
2
);
List<Integer> res1 = encryptionValidity(instructCount, validPeriod, keys);
System.out.println(res1.get(
0
) + " " + res1.get(
1
));
instructCount =
100
;
validPeriod =
1000
;
n =
2
;
keys = Arrays.asList(
2
,
4
);
List<Integer> res2 = encryptionValidity(instructCount, validPeriod, keys);
System.out.println(res2.get(
0
) + " " + res2.get(
1
));
}
}