当前位置:网站首页>Guaba and Computational Geometry
Guaba and Computational Geometry
2022-04-21 06:21:00 【Bzdhxs_nt】

代码
int a[300005],b[300005],c[300005],d[300005],w[300005];
int n;
struct node{
int l,r,w;
bool operator<(const node&t)const{
return l < t.l;
}
}nod[300005];
int ans = -1;
int mx[300005];
void work(){
sort(nod+1,nod+1+n);
mem(mx,0);
for(int i = n;i;i--) mx[i] = max(mx[n+1],nod[i].w);
forr(i,1,n){
int p = upper_bound(nod+1,nod+1+n,node{
nod[i].r,-1,-1}) - nod;
if(p != n+1) ans = max(ans,nod[i].w + mx[p]);
}
}
void solve(){
ans = -1;
cin>>n;
forr(i,1,n) cin>>a[i]>>b[i]>>c[i]>>d[i];
forr(i,1,n) cin>>w[i];
forr(i,1,n){
nod[i] = {
a[i],c[i],w[i]};
}
work();
forr(i,1,n) nod[i] = {
b[i],d[i],w[i]};
work();
cout << ans << endl;
}
signed main()
{
int t;cin>>t;
while(t--) solve();
return 0;
}
版权声明
本文为[Bzdhxs_nt]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_51687628/article/details/124094356
边栏推荐
- Flash frame 1 foundation installation
- JDBC simple implementation of student management system
- Pm2 部署 Nuxt 相关命令
- Implémenter un tableau en tant que fonction JS. Prototype. Foreach (),. Map (),. Filtre ()
- VMware Workstation server service failed to start
- Linux启动MySQL报错
- Build your own blog
- 【ThreadX】H743+ThreadX+FileX移植记录
- 【STM32&LWIP】记录一次诡异的ping不通的解决方法
- 【KSZ8863】KSZ8863交换机芯片的信息汇总与打板验证结果
猜你喜欢
随机推荐
Linux启动MySQL报错
SQL--数据定义
[thread x] netx duo PTP timing client
【STM32&LWIP】记录一次诡异的ping不通的解决方法
6 service and ingress
Sublime Text3 安装简体中文
如何实现一个线程池隔离?
Gojs anhydrous printing plate
Format checking tool eslint
将在CSDN中写好的文章导出为pdf格式
uniapp中动态底部导航栏tabbar实现,权限管理
Sublime Text3 installation simplified Chinese
QThread简单测试理解
applicationContext.xml变成灰色的文档咋解决
C#数组
There is no prompt for importing JSTL tag library URI
Summary of differences between MySQL and Oracle
Error when Linux starts MySQL
Draw biaxial separation diagram with ggplot2
How to download and use the journal latex template









