UVA - 11572 Unique Snowflakes
2016-05-19 20:28
459 查看
容器,不解释
#include <iostream>
#include <set>
#include <algorithm>
using namespace std;
const int N=1000115;
int dp
;
set<int>s;
int main()
{
int t, n;
cin>>t;
while(t--)
{
s.clear();
cin>>n;
for(int i=0; i<n; i++)
{
cin>>dp[i];
}
int l=0, r=0, ans=0;
while(r<n)
{
while(r<n&&!s.count(dp[r]))
{
s.insert(dp[r++]);
}
ans=max(ans,r-l);
s.erase(dp[l++]);
}
cout<<ans<<endl;
}
return 0;
}
相关文章推荐
- POJ 2778 DNA Sequence
- Poj 1904 King's Quest 强连通分量
- gui数据传递的方式讨论汇总
- [UESTC1059]秋实大哥与小朋友(线段树, 离散化)
- 阅读郭林《第一行代码》的笔记——第3章 软件也要拼脸蛋,UI开发的点点滴滴
- 04 - the behavior of the UICollectionViewFlowLayout is not defined
- UITableViewCell设置编辑功能
- UI进阶 即时通讯之XMPP环境搭建
- String,StringBuffer与StringBuilder的区别??
- 63. Unique Paths II
- android开发不可不知的UI知识
- 【Arduino官方教程第一辑】示例程序 4-10 串口事件
- HDU 4667 Building Fence(求凸包的周长)
- 键盘样式(UIKeyboardType)
- Java问题总结33之利用UUID生成全局唯一码(Scala环境运行)
- 【Arduino官方教程第一辑】示例程序 4-9 串口双向调用(使用ASCII字符串)
- 加载图片显示时的图片变形问题(UIImageView)
- 你该知道的 TValue
- Uva1605——Building for UN
- Longest Increasing Subsequence