hdu5904 LCIS
来源:互联网 发布:html5数据统计 编辑:程序博客网 时间:2024/05/01 22:04
这题惩罚我这种经常不管常数的懒人
直接 1e6 TLE 如果1e5对数组枚举过
诶其实很想吐槽些伤心事,但是还是不想在博客上吐口水
不管今年比赛结果如何 请享受比赛
#include<bits/stdc++.h>using namespace std;const int INF = 0x3f3f3f3f;const int MAXN = 1e6+5;#define lson l,m,rt<<1#define rson m+1,r,rt<<1|1int N,M;int A[100005], B[100005];int ha[MAXN], hb[MAXN];int fa[MAXN], fb[MAXN];int main(){ int T; scanf("%d",&T); int ca = 0; while(T--) { ++ca; scanf("%d %d",&N,&M); for(int i = 1; i <= N; ++i) scanf("%d",&A[i]); for(int i = 1; i <= M; ++i) scanf("%d",&B[i]); for(int i = 1; i <= N; ++i) { if(fa[A[i]-1] == ca) ha[A[i]] = ha[A[i]-1]; else ha[A[i]] = A[i]; fa[A[i]] = ca; } for(int i = 1; i <= M; ++i) { if(fb[B[i]-1] == ca) hb[B[i]] = hb[B[i]-1]; else hb[B[i]] = B[i]; fb[B[i]] = ca; } int ans = 0; for(int i = N; i >= 1; --i) { if(ans > i) break; int j = A[i]; if(fa[j]==ca && fb[j]==ca) ans = max(ans, j-max(hb[j],ha[j])+1 ); } printf("%d\n",ans); } return 0;}
0 0
- hdu5904 LCIS
- HDU5904-LCIS
- hdu5904 LCIS(dp)
- hdu5904 LCIS dp
- HDU5904 LCIS (DP)
- hdu5904 BestCoder Round #87 LCIS -dp
- hdu5904
- hdu5902 GCD is Funny(错) && hdu5904 LCIS(最长公共连续上升子序列)
- HDU5904【瞎搞】
- LCIS
- LCIS
- LCIS
- LCIS
- LCIS
- LCIS
- LCIS
- LCIS
- LCIS
- **Java 拦截器和过滤器(转)**
- CentOS7基本工具安装
- 关于SpringMVC的静态资源文件加载问题
- STL Day01
- 实验二——任务三
- hdu5904 LCIS
- 安卓开发之自定义粒子旋转动画加载控件
- Servlet-03
- 大话存储-学习总结-2-RAID
- Get 和 Post 请求的区别
- Android搜索框输入过滤特殊字符
- 重定向和转发
- 我学Hibernate - 08 二级缓存 ehcache
- Ubuntu 中Eclipse 默认的OpenJDK 和 SUNJDK问题总结