【codeforces 782A】Andryusha and Socks
2017-10-04 18:45
429 查看
【题目链接】: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 ; 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; }
相关文章推荐
- Codeforces 780A-Andryusha and Socks
- Codeforces 782 Andryusha and Socks
- CodeForces 780A Andryusha and Socks【水题】
- Problem--460A--Codeforces--A. Vasya and Socks
- 【codeforces 782C】Andryusha and Colored Balloons
- codeforces水题100道 第十五题 Codeforces Round #262 (Div. 2) A. Vasya and Socks (brute force)
- CodeForces 780C Andryusha and Colored Balloons (DFS)
- AC日记——Andryusha and Socks Codeforces 780a
- 【codeforce】403 Div.2 A Andryusha and Socks
- 【Codeforces 781 A Andryusha and Colored Balloons】+ DFS
- CodeForces 460 A. Vasya and Socks(379A.New Year Candles)
- CF-Round#403 Div2 A. Andryusha and Socks
- CodeForces 780C Andryusha and Colored Balloons【DFS】
- CodeForces - 782 C Andryusha and Colored Balloons(搜索)
- codeforces 780-C. Andryusha and Colored Balloons(dfs)
- CodeForces-460A-Vasya And Socks
- Codeforces 780C-Andryusha and Colored Balloons
- Codeforces Round #403 (Div. 2, based on Technocup 2017 Finals) A. Andryusha and Socks
- Codeforces 780G Andryusha and Nervous Barriers
- Andryusha and Socks vj