Finite or infinite
Practice
2.6 (10 votes)
Algorithms
Math
Number theory
Number theory
Problem
76% Success 3210 Attempts 30 Points 5s Time Limit 256MB Memory 1024 KB Max Code
You are given the following:
- A set \(S\) of size \(n\)
- A class of functions called \(\mathbb{FUNC}\) \(f: \mathbb{C} \to \mathbb{C}\) such that \(\forall\ k \in S, f^k(x) = x \) holds \(\forall\ x\)
- A set \(G\) that is defined based on the natural numbers such that a number \(l \in G\) if and only if \(f^l(x) = x \forall x\) holds \(\forall f \in \mathbb{FUNC}\)
Your task is to construct the complement set of \(G\) based on the natural numbers, which implies that a number \(l \in G' \) if and only if \(l \notin G\).
If the cardinality of \(G'\) is finite, then print \(FINITE\). Otherwise, print \(INFINITE\). There are multiple test cases.
Mathematics note
- \(f: \mathbb{C} \to \mathbb{C}\) is a notation that is used to describe a function \(f\) that considers a complex number, \(a+ib\), as an input and provides another complex number, \(c+id\), as the output.
- \(\forall \) is read as for all, particularly if \(f^l(x) = x \forall x\) which implies that \(f^l(x) = x\) is true for all \(x \) in the domain of the function. Here, domain is a complex number.
- \(f^l(x) = f(f(f(..f(x)))\) where \(f\) is repeated \(l\) times which means that \(f^2(x) = f(f(x)), f^3(x) = f(f(f(x)))\).
- \(\in\) is used to denote a set that is a subset of another set.
- Cardinality is used to denote the size of a set.
Input format
- First line: \(t\) denoting the number of test cases
- For each test case:
- First line: \(n\) denoting the size of the set \(S\)
- Second line: \(n\) elements of set \(S\)
Output format
For each test case, print the string \(FINITE\) or \(INFINITE\) in a single line.
Constraints
\(1\leq\) sum of \(n\) over all the test cases \(\leq 100000\)
If \(k \in S\), then \(1 \leq k \leq 100000\)
Submissions
Please login to view your submissions
Similar Problems
Points:30
23 votes
Tags:
EasyNumber Theory
Points:30
12 votes
Tags:
EasyMathNumber TheoryNumber theory
3.4141
Points:30
59 votes
Tags:
ApprovedEasyMathNumber TheoryOpen
Editorial