本文共 885 字,大约阅读时间需要 2 分钟。
题目链接:
= - =曾经的三分姿势不对竟然没有被卡掉,。,太逗。。
#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;#define M 200004#define N 100040#define L(x) (x<<1)#define R(x) (x<<1|1)#define Mid(x,y) ((x+y)>>1)#define ll __int64#define Sum(x) tree[x].sum#define Mod(x) tree[x].mod#define inf 1000000000ll n,m;ll a[N],b[N];ll ok(ll x){ ll ans = 0; for(ll i = 1; i <= n; i++)if(x>a[i])ans+=(x-a[i]); for(ll i = 1; i <= m; i++)if(x =maxx){puts("0");continue;} ll ans = inf; ll l = minn, r = maxx; ans = min(ok(l),ok(r)); while(l tmp2) l = mid1; else r = mid2; ans = min(ans, min(tmp1, tmp2)); } printf("%I64d\n",ans); } return 0;}/*2 22 33 53 21 2 33 43 24 5 61 2*/
转载于:https://www.cnblogs.com/blfbuaa/p/6962709.html