【题目链接】:http://codeforces.com/contest/782/problem/A

【题意】



如果手套没有成一双,那么其中的一只就会被放在桌子上;

问你桌子上手套的只数最多的时候有几只.

【题解】



按照题意模拟就好



【完整代码】

#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define rei(x) scanf("%d",&x)
#define rel(x) scanf("%lld",&x) typedef pair<int, int> pii;
typedef pair<LL, LL> pll; const int dx[9] = { 0,1,-1,0,0,-1,-1,1,1 };
const int dy[9] = { 0,0,0,-1,1,-1,1,-1,1 };
const double pi = acos(-1.0);
const int N = 1e5+100; int n, ans = 1,now;
bool bo[N]; int main()
{
//freopen("F:\\rush.txt", "r", stdin);
rei(n);
rep1(i, 1, 2 * n)
{
int x;
rei(x);
if (!bo[x])
{
now++;
ans = max(ans, now);
bo[x] = true;
}
else
{
bo[x] = false;
now--;
}
}
printf("%d\n", ans);
return 0;
}

最新文章

  1. .NET 实现并行的几种方式(四)
  2. POI
  3. 我的git学习
  4. [.NET] 自己实现任务池(模仿线程池)
  5. 往sql数据库表中添加字段
  6. SQL Server中中数据行批量插入脚本的存储实现
  7. Codeforces 711 D. Directed Roads (DFS判环)
  8. lintcode 中等题:majority number III主元素III
  9. &lt;转&gt;Python的内存泄漏及gc模块的使用分析
  10. NOIP2005-普及组复赛-第二题-校门外的树
  11. 开源分布式任务调度平台Cuckoo-Schedule
  12. Oracle表生成JavaBean
  13. grunt之clean、copy
  14. 对象和XML文件的转换
  15. 分别基于TensorFlow、PyTorch、Keras的深度学习动手练习项目
  16. 用 DocumentFormat.OpenXml 和Microsoft.Office.Interop.Word 写入或者读取word文件
  17. [arc102E]Stop. Otherwise...[容斥+二项式定理]
  18. 东哥讲义2 - 基于TCP,UDP协议的攻击,分析与防护
  19. maven nexus私服搭建
  20. 树形DP初探•总结

热门文章

  1. json问题小结
  2. 2.1 Vue组件
  3. P2P平台项目建设几点注意事项
  4. 通过wmi获取本地硬件信息的一些疑问。
  5. HttpWatch--time chart分析
  6. shrio 权限管理filterChainDefinitions过滤器配置(转)
  7. Android之怎样用代码使编辑框等组件显示为圆角
  8. bootstrap课程1 bootstrap为什么这么火
  9. Mac OS X Kernel Basic User Credentials
  10. [PostgreSQL] Ensure Uniqueness in Postgres