Geometric sequence
Practice
5 (4 votes)
Basic programming
Basics of implementation
Easy
Implementation
Problem
84% Success 2468 Attempts 30 Points 3s Time Limit 256MB Memory 1024 KB Max Code
Given a sequence \(a_1{\dots}a_n\).
You need to find a subsequence \(a_{b_1},a_{b_2},\dots,a_{b_m}(b_1< b_2<\dots
Your goal is to maximize \(m\).
Input
First line contains an integer \(n\).
Second line contains \(n\) integers, representing the sequence \(a_1{\dots}a_n\).
Output
An integer representing the maximum value of \(m\).
Constraints
\(1\le n\le 10^5\)
\(-10^5\le a_i\le 10^5\)
Explanation
\(1,-2,4\) and \(3,0,0\) are two possible subsequences.
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
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:30
17 votes
Tags:
Easy
Points:30
19 votes
Tags:
Easy
Points:30
25 votes
Tags:
Basic ProgrammingBasics of ImplementationBit ManipulationImplementationPermutation and combination
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
Results
Custom Input
Run your code to see the output