题意 题目链接 Sol 发现abcdef是互不相关的 那么meet in the middle一下.先算出abc的,再算def的 注意d = 0的时候不合法(害我wa了两发..) #include<bits/stdc++.h> #define LL long long using namespace std; const int MAXN = 101, SS = 2e6 + 10; map<LL, LL> mp; int N; LL a[MAXN], ans; int a1[SS]…
题意 题目链接 Sol 把前一半放在左边,后一半放在右边 meet in the middle一波 统计答案的时候开始想的是hash,然而MLE了两个点 实际上只要排序之后双指针扫一遍就行了 #include<bits/stdc++.h> using namespace std; const int MAXN = 7, MAX = 1e7 + 10; int K[MAXN], P[MAXN], N, M, ans; int a1[MAX], c1, a2[MAX], c2, cnt[MAX];…
[BZOJ4800][Ceoi2015]Ice Hockey World Championship (meet in the middle) 题面 BZOJ 洛谷 题解 裸题吧,顺手写一下... #include<iostream> #include<cstdio> #include<algorithm> using namespace std; #define ll long long inline ll read() { ll x=0;bool t=false;ch…