Finding subsets
Practice
1 (2 votes)
C++
Basic math
Mathamatics
Math
Problem
38% Success 1458 Attempts 50 Points 10s Time Limit 256MB Memory 1024 KB Max Code
You are given a sequence of non-negative numbers and you are required to put some of these numbers into a bucket such that:
The product of any two distinct elements in the bucket is not a cube and the numbers in the bucket must be maximum.
Now, your task is to determine the maximum number of elements in the bucket.
Input format
- The first line contains a single integer \(N\).
- Each of the next \(N\) lines contains elements of the sequence
Output format
Print the maximum number of elements in the bucket
Constraints
\(1 \le N \le 1e5\)
\(1 \le A_i \le 10^{10}\)
Sample Input
8 1 2 3 4 5 6 7 8
Sample Output
6
Explanation
The element in the bucket areĀ 1, 2, 3, 5, 6, 7.
Code Editor
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Submissions
Please login to view your submissions
Similar Problems
Points:50
16 votes
Tags:
MathematicsMedium-HardMathematicsMathamatics
Points:50
24 votes
Tags:
Math BasicAlgorithmsBasic MathMath
Points:50
17 votes
Tags:
Basic MathC++Math
Editorial
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor