Uva11572
2024-09-08 13:57:29
读入可以不需要存入数组
#include<bits/stdc++.h> #define inf 0x3f3f3f3f //const int maxn=; using namespace std; int t; int n; int main()
{
scanf("%d",&t);
while(t--){
map<int, int> m;
scanf("%d",&n);
int ans = -inf;
int cnt = ;
int imax = ;
int x;
for(int i = ; i <= n; ++i){
scanf("%d",&x);
if(!m[x]){
++cnt;
} else {
ans = max(ans, cnt);
imax = max(imax, m[x] + );
cnt = i - imax + ;
}
m[x] = i;
}
ans = max(ans, cnt);
printf("%d\n",ans);
}
return ;
}
最新文章
- JSP里面ajax不能返回后台传出的值得问题。。。。
- 山东省选 郁闷的小J
- ASP.NET MVC利用ajax把action的JavaScript注册到页面并执行
- Windows Server 2012学习文档
- 【原】NGUI中的UIRoot脚本功能
- demo_06Canvas
- webform的三级联动
- sqlserver 批量删除相同前缀名的表
- Eclipse常见操作
- 《 iPhone X ARKit Face Tracking 》
- Jetty添加Filter过滤器
- 由html,body{height:100%}引发的对html和body的思考
- IDictionary使用/声明
- intellij idea创建maven项目
- OpenAuth.Net.landv分支之旅开始制作CRM系统
- CodeForces - 455D
- 铁板纹理 Base Shape
- pyautogui_pdf内容提取到excel内_3
- Windows和Mac上NodeJS和Express的安装
- Redis缓存机制一为什么要用Redis
热门文章
- html5--1.20 课程小结与若干点补充
- 分享知识-快乐自己:oracle12c创建用户提示ORA-65096:公用用户名或角色无效
- Python 连接Oracle数据库
- AtCoder Grand Contest #026 B - rng_10s
- ACM学习历程—HDU1716 排列2(dfs &;&; set容器)
- ACM学习历程——hihoCoder挑战赛10A 01串(策略)
- Mysql源码学习——源码目录结构
- 获取iOS应用中当前处于Activity状态的ViewController
- java去任意范围的随机数
- editplus怎么在前后插入字符