2020-2021 ACM-ICPC, Asia Seoul Regional Contest L. Two Buildings (决策单调性 分治)

网友投稿 664 2022-11-17

2020-2021 ACM-ICPC, Asia Seoul Regional Contest L. Two Buildings (决策单调性 分治)

2020-2021 ACM-ICPC, Asia Seoul Regional Contest L. Two Buildings (决策单调性 分治)

代码

// Problem: L. Two Buildings// Contest: Codeforces - 2020-2021 ACM-ICPC, Asia Seoul Regional Contest// URL: Memory Limit: 512 MB// Time Limit: 1000 ms// // Powered by CP Editor (namespace std;typedef long long ll;typedef unsigned long long ull;typedef pairPLL;typedef pairPII;typedef pairPDD;typedef pairPSS;#define I_int llinline ll read(){ll x = 0, f = 1;char ch = getchar();while(ch < '0' || ch > '9'){if(ch == '-')f = -1;ch = getchar();}while(ch >= '0' && ch <= '9'){x = x * 10 + ch - '0';ch = getchar();}return x * f;} inline void write(ll x){if (x < 0) x = ~x + 1, putchar('-');if (x > 9) write(x / 10);putchar(x % 10 + '0');} #define read read()#define closeSync ios::sync_with_stdio(0);cin.tie(0);cout.tie(0)#define multiCase int T;cin>>T;for(int t=1;t<=T;t++)#define rep(i,a,b) for(int i=(a);i<=(b);i++)#define repp(i,a,b) for(int i=(a);i<(b);i++)#define per(i,a,b) for(int i=(a);i>=(b);i--)#define perr(i,a,b) for(int i=(a);i>(b);i--)#define x first#define y secondll ksm(ll a, ll b,ll mod){ll res = 1;while(b){if(b&1)res=res*a%mod;a=a*a%mod;b>>=1;}return res;} const int maxn=5e6+100,inf=0x3f3f3f3f;ll ans,n,c[maxn];struct node{ ll x,y;}a[maxn],b[maxn]; bool cmp(node a,node b){ if(a.x==b.x) return a.yr1||l2>r2) return 0; int mid=(l1+r1)/2; ll maxx=-1e18,pos=l2; for(int i=l2;i<=r2;i++){ if(a[mid].x>b[i].x&&a[mid].y>b[i].y) continue; ll tmp=(b[i].x-a[mid].x)*(b[i].y-a[mid].y); if(maxxmp; for(int i=2;i<=n;i++) if(a[i].y>=a[pos].y) mp[i]=1; else pos=i; for(int i=1;i<=n;i++) if(!mp[i]) a[++idx]=a[i]; int tot=0;mp.clear(); pos=n; for(int i=n-1;i;i--) if(b[i].y<=b[pos].y) mp[i]=1; else pos=i; for(int i=1;i<=n;i++) if(!mp[i]) b[++tot]=b[i]; solve(1,idx,1,tot); cout<

​​参考1​​​​参考2​​

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:【安卓开发】调用手机的相机进行拍照并且保存在本地的APP
下一篇:【15】进大厂必须掌握的面试题-容器化和虚拟化面试
相关文章

 发表评论

暂时没有评论,来抢沙发吧~