4300: 绝世好题 Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://www.lydsy.com/JudgeOnline/problem.php?id=4300 Description 给定一个长度为n的数列ai,求ai的子序列bi的最长长度,满足bi&bi-1!=0(2<=i<=len). Under two situations the player could score one point. ⋅1. If you touc…
设f[i][j]表示数列到i为止最后一项第j位为1的最大子序列长度,每次从i-1中1<<j&a[i]!=0的位+1转移来 然后i维是不需要的,答案直接在dp过程中去max即可 #include<iostream> #include<cstdio> using namespace std; int n,f[35],ans; int read() { int r=0,f=1; char p=getchar(); while(p>'9'||p<'0') {…
对于每一个数字拆位,然后维护一个大小为 30 左右的桶即可. code: #include <bits/stdc++.h> #define N 100006 #define setIO(s) freopen(s".in","r",stdin) using namespace std; int mx[N]; int main() { // setIO("input"); int i,j,n,ans=0; scanf("%d&q…