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…
题目链接:绝世好题 暴力就不用说了,和lis神似,O(n2)妥妥的挂掉,但可以得大部分分(好像是90,80)... 考虑优化,来一发非正解的优化: #include<bits/stdc++.h> using namespace std; const int N=101000; int n,a[N],f[N],ans,tot; priority_queue<pair<int,int> >q; struct gg { int x,y; }b[N]; inline int r…
BZOJ初级水题列表——献给那些想要进军BZOJ的OIers 代码长度解释一切! 注:以下代码描述均为C++ RunID User Problem Result Memory Time Code_Length 695765 Eolv 1000 Accepted 804 kb 0 ms 118 B 739478 Eolv 2463 Accepted 804 kb 0 ms 134 B 696662 Eolv 1968 Accepted 1272 kb 48 ms 137 B 739546 Eolv…
二维树状数组... 自己YY一下再推一下应该可以搞出来... ---------------------------------------------------------------------------------- #include<cstdio> #include<cstring> #include<algorithm> #include<iostream> #define rep( i , n ) for( int i = 0 ; i &…