#GL0000336. Madoka và ngôi trường tốt nhất nước Nga (Madoka and the Best School in Russia)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Madoka và ngôi trường tốt nhất nước Nga (Madoka and the Best School in Russia)
Madoka and the Best School in Russia
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
Given positive integers with :
- A positive integer is good if it is divisible by .
- A number is beautiful if it is good but cannot be written as the product of two good integers.
Determine whether admits at least two distinct factorizations into one or more beautiful numbers. The factor order is irrelevant: two factorizations with the same multiset of factors are identical.
For example, has distinct beautiful factorizations and .
Each PHOJ input file contains one case (the initial test count in the original Codeforces problem is omitted).
Input
One line containing the integers satisfying .
Output
Print YES if there are at least two distinct beautiful-factor multisets; otherwise print NO.
Subtasks
-
Subtask 1 (20 points): , .
-
Subtask 2 (30 points): , .
-
Subtask 3 (50 points): , .
Examples
Example 1
Input
6 2
Output
NO
Explanation
6 has only one beautiful-factor multiset: [6].
Example 2
Input
36 2
Output
YES
Explanation
Two different multisets exist: 18×2 and 6×6; every factor is divisible by 2 but not by 4.
Example 3
Input
1000 10
Output
YES
Explanation
1000=10×10×10 and 1000=20×50; all factors in both decompositions are beautiful.
Example 4
Input
128 4
Output
NO
Explanation
The only valid multiset is 4×4×8. The factor 16 is not beautiful because 16=4×4.