Type: Default 2000ms 512MiB

LXS

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

题目描述

给你一个长度为 nn 的数组 ana_n,你需要求出一个最长的子序列 CC,使得其相邻两项按位与的结果均非零( i,Ci & Ci+1>0\forall\ i, C_i\ \&\ C_{i+1}>0)。

请输出这个最长子序列长度。

输入格式

第一行一个整数 nn

接下来一行,nn 个整数 aia_i,描述这个数组。

输出格式

一行一个整数,表示答案。

样例输入

7
1 4 5 6 2 3 4

样例输出

5

数据范围

对于30%30\%的数据,n20n\leq 20

对于另外40%40\%的数据,n2000,ai2000n\leq 2000, a_i\leq 2000

对于所有数据,1n105,0ai1091\leq n\leq 10^5,0\leq a_i \leq 10^9

2023CSP赛前冲刺模拟7

Not Attended
Status
Done
Rule
OI
Problem
4
Start at
2023-10-4 8:30
End at
2023-10-4 12:00
Duration
3.5 hour(s)
Host
Partic.
4