[kuangbin带你飞]专题七 线段树 ABCDE 题解,持续更新

电力系统直流潮流计算研究【IEEE9节点】(Matlab代码实现) 内容概要:本文围绕《电力系统直流潮流计算研究【IEEE9节点】(Matlab代码实现)》展开,系统介绍了基于IEEE9标准测试系统的直流潮流计算方法及其Matlab编程实现过程。资源内容聚焦于电力系统稳态分析中的核心问题,详细阐述了直流潮流的数学模型构建、节点导纳矩阵形成、功率注入处理及线性方程组求解等关键技术环节,并提供完整的可运行Matlab代码,便于读者理解与复现。该研究不仅适用于电力系统规划、运行与控制的教学实践,还可作为复杂电网分析的前期基础工具,服务于故障分析、网络重构与优化调度等高级应用场景。该资源隶属于涵盖智能优化算法、机器学习、电力系统管理等多个方向的综合性科研资料体系,具有较高的工程参考价值和教学实用性。; 适合人群:具备电力系统分析基础知识及一定Matlab编程能力的高校电气工程及相关专业的本科生、研究生、科研人员,以及从事电力系统仿真、电网调度与自动化领域的工程技术人员。; 使用场景及目标:①深入理解直流潮流计算的基本原理及其在电力系统分析中的作用;②利用IEEE9节点系统开展教学实验、课程设计或科研验证,掌握潮流计算的数值实现方法;③作为电力系统高级应用(如最优潮流、可靠性评估、分布式电源接入分析)的前置模块进行扩展研究。; 阅读建议:建议读者结合经典电力系统分析教材同步学习,重点理解潮流计算的数学建模思路与Matlab代码的实现逻辑,通过实际运行、调试程序加深对算法流程的理解,并尝试将该方法迁移至其他IEEE标准测试系统(如IEEE14、IEEE30等)进行对比分析,以提升综合应用能力。 立即下载

【专题网址】点击打开链接

【A HDU 1166】

#include <cstdio>
#include <cstring>
#include <iostream>
using namespace std;
const int maxn = 500005;
struct node{
    int l,r,sum;
}Tree[maxn<<2];
int a[maxn];
void Push_Up(int rt){
    Tree[rt].sum = Tree[rt<<1].sum+Tree[rt<<1|1].sum;
}
void Build(int l,int r,int rt){
    Tree[rt].l=l,Tree[rt].r=r;
    if(l==r){
        Tree[rt].sum=a[l];
        return ;
    }
    int mid=(Tree[rt].l+Tree[rt].r)>>1;
    Build(l,mid,rt<<1);
    Build(mid+1,r,rt<<1|1);
    Push_Up(rt);
}
void Update(int id,int val,int l,int r,int rt){
    if(Tree[rt].l==id&&Tree[rt].r==id){
        Tree[rt].sum+=val;
        return ;
    }
    int mid=(Tree[rt].l+Tree[rt].r)>>1;
    if(id<=mid) Update(id,val,l,mid,rt<<1);
    else Update(id,val,mid+1,r,rt<<1|1);
    Push_Up(rt);
}
int query_ans(int L,int R,int l,int r,int rt){
    if(L<=Tree[rt].l&&Tree[rt].r<=R){
        return Tree[rt].sum;
    }
    int ret=0;
    int mid=(Tree[rt].l+Tree[rt].r)>>1;
    if(L<=mid) ret+=query_ans(L,R,l,mid,rt<<1);
    if(mid<R)  ret+=query_ans(L,R,mid+1,r,rt<<1|1);
    return ret;
}
int main(){
    int tt,n,l,r,ncase=1;
    scanf("%d",&tt);
    while(tt--){
        scanf("%d",&n);
        for(int i=1; i<=n; i++) scanf("%d",&a[i]);
        memset(Tree,0,sizeof(Tree));
        Build(1,n,1);
        char op[10];
        printf("Case %d:\n",ncase++);
        while(scanf("%s",op)){
            if(strcmp(op,"End")==0) break;
            scanf("%d%d",&l,&r);
            if(op[0]=='Q') printf("%d\n",query_ans(l,r,1,n,1));
            if(op[0]=='A') Update(l,r,1,n,1);
            if(op[0]=='S') Update(l,-r,1,n,1);
        }
    }
    return 0;
}

【B HDU 1754 I Hate It】


#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 200010;
struct node{
    int l,r,maxx;
}Tree[maxn<<2];
int a[maxn];
void Push_Up(int rt){
    Tree[rt].maxx = max(Tree[rt<<1].maxx,Tree[rt<<1|1].maxx);
}
void Build(int l,int r,int rt){
    Tree[rt].l=l,Tree[rt].r=r;
    if(l==r){
        Tree[rt].maxx=a[l];
        return ;
    }
    int mid=(l+r)>>1;
    Build(l,mid,rt<<1);
    Build(mid+1,r,rt<<1|1);
    Push_Up(rt);
}
void Update(int id,int val,int l,int r,int rt){
    if(Tree[rt].l==id&&Tree[rt].r==id){
        Tree[rt].maxx=val;
        return ;
    }
    int mid=(Tree[rt].l+Tree[rt].r)>>1;
    if(id<=mid) Update(id,val,l,mid,rt<<1);
    else        Update(id,val,mid+1,r,rt<<1|1);
    Push_Up(rt);
}
int query_ans(int L,int R,int l,int r,int rt){
    if(L<=Tree[rt].l&&Tree[rt].r<=R){
        return Tree[rt].maxx;
    }
    int ret=0;
    int mid=(Tree[rt].l+Tree[rt].r)>>1;
    if(L<=mid) ret=max(ret,query_ans(L,R,l,mid,rt<<1));
    if(mid<R)  ret=max(ret,query_ans(L,R,mid+1,r,rt<<1|1));
    return ret;
}
int main(){
    int n,m,l,r;
    while(~scanf("%d%d",&n,&m)){
        for(int i=1; i<=n; i++) scanf("%d",&a[i]);
        Build(1,n,1);
        char op[10];
        while(m--){
            scanf("%s%d%d",op,&l,&r);
            if(op[0]=='U') Update(l,r,1,n,1);
            else           printf("%d\n",query_ans(l,r,1,n,1));
        }
    }
    return 0;
}

【C POJ 3468 A Simple Problem with Integers】

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
const int maxn = 100010;
struct node{
    int l,r;
    ll sum,lazy;
}Tree[maxn<<2];
int a[maxn];
void Push_Up(int rt){
    Tree[rt].sum = Tree[rt<<1].sum+Tree[rt<<1|1].sum;
}
void Push_Down(int rt,int m){
    if(Tree[rt].lazy!=0){
        Tree[rt<<1].lazy+=Tree[rt].lazy;
        Tree[rt<<1|1].lazy+=Tree[rt].lazy;
        Tree[rt<<1].sum+=(m-(m>>1))*Tree[rt].lazy;
        Tree[rt<<1|1].sum+=(m>>1)*Tree[rt].lazy;
        Tree[rt].lazy=0;
    }
}
void Build(int l,int r,int rt){
    Tree[rt].l=l,Tree[rt].r=r,Tree[rt].lazy=0;
    if(l==r){
        Tree[rt].sum=a[l];
        return ;
    }
    int mid=(l+r)>>1;
    Build(l,mid,rt<<1);
    Build(mid+1,r,rt<<1|1);
    Push_Up(rt);
}
void Update(int L,int R,int c,int rt){
    if(L<=Tree[rt].l&&Tree[rt].r<=R){
        Tree[rt].lazy+=c;
        Tree[rt].sum+=(ll)c*(Tree[rt].r-Tree[rt].l+1);
        return ;
    }
    Push_Down(rt,Tree[rt].r-Tree[rt].l+1);
    int mid=(Tree[rt].l+Tree[rt].r)>>1;
    if(L<=mid) Update(L,R,c,rt<<1);
    if(mid<R)  Update(L,R,c,rt<<1|1);
    Push_Up(rt);
}
ll query_ans(int L,int R,int rt){
    if(L<=Tree[rt].l&&Tree[rt].r<=R){
        return Tree[rt].sum;
    }
    Push_Down(rt,Tree[rt].r-Tree[rt].l+1);
    ll ret=0;
    int mid=(Tree[rt].l+Tree[rt].r)>>1;
    if(L<=mid) ret+=query_ans(L,R,rt<<1);
    if(mid<R)  ret+=query_ans(L,R,rt<<1|1);
    return ret;
}
int main(){
    int n,m,l,r,c;
    while(~scanf("%d%d",&n,&m)){
        for(int i=1; i<=n; i++) scanf("%d",&a[i]);
        Build(1,n,1);
        char op[10];
        while(m--){
            scanf("%s",op);
            if(op[0]=='Q'){
                scanf("%d%d",&l,&r);
                printf("%I64d\n",query_ans(l,r,1));
            }else{
                scanf("%d%d%d",&l,&r,&c);
                Update(l,r,c,1);
            }
        }
    }
    return 0;
}

【D POJ 2528 Mayor's posters】

#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
const int maxn = 10010;
struct node{
    int l,r,lazy;
}Tree[maxn<<4];
struct seg{
    int l,r;
    seg(){}
    seg(int l,int r):l(l),r(r){}
}query[maxn];
int X[maxn<<2],ans;
bool Hash[maxn<<4];
void Push_Down(int rt){
    if(Tree[rt].lazy!=-1){
        Tree[rt<<1].lazy=Tree[rt<<1|1].lazy=Tree[rt].lazy;
        Tree[rt].lazy=-1;
    }
}
void Build(int l,int r,int rt){
    Tree[rt].l=l,Tree[rt].r=r,Tree[rt].lazy=-1;
    if(l==r) return ;
    int m=(l+r)>>1;
    Build(l,m,rt<<1);
    Build(m+1,r,rt<<1|1);
}
void Update(int L,int R,int c,int rt){
    if(L<=Tree[rt].l&&Tree[rt].r<=R){
        Tree[rt].lazy=c;
        return ;
    }
    Push_Down(rt);
    int mid=(Tree[rt].l+Tree[rt].r)>>1;
    if(L<=mid) Update(L,R,c,rt<<1);
    if(mid<R)  Update(L,R,c,rt<<1|1);
}
void query_ans(int l,int r,int rt){
    if(Tree[rt].lazy!=-1){
        if(!Hash[Tree[rt].lazy]) ans++;
        Hash[Tree[rt].lazy]=true;
        return ;
    }
    if(l==r) return ;
    int mid=(Tree[rt].l+Tree[rt].r)>>1;
    query_ans(l,mid,rt<<1);
    query_ans(mid+1,r,rt<<1|1);
}
int main(){
    int tt,n,l,r;
    int cnt,m;
    scanf("%d",&tt);
    while(tt--){
        cnt=0;
        scanf("%d",&n);
        for(int i=0; i<n; i++){
            scanf("%d%d",&l,&r);
            query[i]=seg(l,r);
            X[cnt++]=l,X[cnt++]=r;
        }
        //离散化之后做成线段树
        sort(X,X+cnt);
        m=1;
        for(int i=1; i<cnt; i++)  if(X[i]!=X[i-1])   X[m++]=X[i];
        for(int i=m-1; i>=1; i--) if(X[i]!=X[i-1]+1) X[m++]=X[i-1]+1;
        sort(X,X+m);
        Build(0,m,1);
        for(int i=0; i<n; i++){
            int l=lower_bound(X,X+m,query[i].l)-X;
            int r=lower_bound(X,X+m,query[i].r)-X;
            Update(l,r,i,1);
        }
        memset(Hash,false,sizeof(Hash));
        ans=0;
        query_ans(0,m,1);
        printf("%d\n",ans);
    }
    return 0;
}

【E HDU 1698 Just a Hook 】


#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std;
#define ll long long
const int maxn = 100010;
struct node{
    int l,r;
    ll sum,lazy;
}Tree[maxn<<2];
int a[maxn];
void Push_Up(int rt){
    Tree[rt].sum = Tree[rt<<1].sum+Tree[rt<<1|1].sum;
}
void Push_Down(int rt,int m){
    if(Tree[rt].lazy!=0){
        Tree[rt<<1].lazy=Tree[rt].lazy;
        Tree[rt<<1|1].lazy=Tree[rt].lazy;
        Tree[rt<<1].sum=(m-(m>>1))*Tree[rt].lazy;
        Tree[rt<<1|1].sum=(m>>1)*Tree[rt].lazy;
        Tree[rt].lazy=0;
    }
}
void Build(int l,int r,int rt){
    Tree[rt].l=l,Tree[rt].r=r,Tree[rt].lazy=0;
    if(l==r){
        Tree[rt].sum=1;
        return ;
    }
    int mid=(l+r)>>1;
    Build(l,mid,rt<<1);
    Build(mid+1,r,rt<<1|1);
    Push_Up(rt);
}
void Update(int L,int R,int c,int rt){
    if(L<=Tree[rt].l&&Tree[rt].r<=R){
        Tree[rt].lazy=c;
        Tree[rt].sum=(ll)c*(Tree[rt].r-Tree[rt].l+1);
        return ;
    }
    Push_Down(rt,Tree[rt].r-Tree[rt].l+1);
    int mid=(Tree[rt].l+Tree[rt].r)>>1;
    if(L<=mid) Update(L,R,c,rt<<1);
    if(mid<R)  Update(L,R,c,rt<<1|1);
    Push_Up(rt);
}
ll query_ans(int L,int R,int rt){
    if(L<=Tree[rt].l&&Tree[rt].r<=R){
        return Tree[rt].sum;
    }
    Push_Down(rt,Tree[rt].r-Tree[rt].l+1);
    ll ret=0;
    int mid=(Tree[rt].l+Tree[rt].r)>>1;
    if(L<=mid) ret+=query_ans(L,R,rt<<1);
    if(mid<R)  ret+=query_ans(L,R,rt<<1|1);
    return ret;
}
int main(){
    int tt,n,q;
    int l,r,c,ncase=1;
    scanf("%d",&tt);
    while(tt--){
        scanf("%d",&n);
        Build(1,n,1);
        scanf("%d",&q);
        while(q--){
            scanf("%d%d%d",&l,&r,&c);
            Update(l,r,c,1);
        }
        printf("Case %d: The total value of the hook is %I64d.\n",ncase++,Tree[1].sum);
    }
    return 0;
}

【PS】这几个题都是非常简单的,因此只上了我自己的代码,如果不懂可以看其他人的博客的解题思路。专题以后的题,持续更新。。。

ANSYS——“There is at least 1 small equation solver pivot term”问题的解决办法 阅读详情

相关推荐

数据中心光模块升级实录:从200G QSFP56到400G QSFP-DD的踩坑指南

本文记录了数据中心从200G QSFP56升级至400G QSFP-DD光模块的完整实战经验。文章深入剖析了升级过程中面临的兼容性、链路预算、布线、散热与功耗管理等核心挑战,并提供了具体的解决方案与排坑指南,为高速网络升级提供了宝贵的实践参考。

butter的博客 485

[kuangbin带你飞]专题七 线段树

点击打开链接 A(hdu 1166 敌兵布阵 )中文体面,线段树单点更新,求一段区间和 #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define LL long long #define inf

Kiwi21 983

别再为格式发愁:safetensors转GGUF的三种高效方法及Ollama集成对比

本文详细介绍了将safetensors格式转换为GGUF格式的三种高效方法,包括llama.cpp原生转换、GGUF官方工具链和Transformers中转方案,并对比了它们在Ollama集成中的表现。文章还提供了实际项目中的踩坑经验和性能调优建议,帮助开发者快速掌握模型转换技术。

weixin_42651281的博客 650

[kuangbin带你飞]专题七 线段树 题解(未完)

[kuangbin带你飞]专题七 线段树题解: A 经典的单点更新,区间求和:#include<bits/stdc++.h> using namespace std; #define root 1,n,1 #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 const int N=5e4+10; int n,sum[N<<2]; void push_

笔记 641

手把手教你解决CentOS sshd启动报错:从权限问题到目录缺失的全套解决方案

本文提供了一套完整的CentOS SSH服务启动故障排查与修复方案。针对sshd启动报错,从systemd日志分析、sshd -t配置测试入手,详细解决了私钥文件权限过宽(如0644错误)和权限分离目录缺失等典型问题,并附带了扩展排查清单,帮助运维人员系统性地定位和解决连接故障。

weixin_29248611的博客 155

WSL2搭建RFIC设计环境:Cadence+Python+Spectre全链路实战

射频集成电路(RFIC)设计依赖高精度仿真、图形化交互与跨平台数据协同,传统Linux工作站成本高、Windows兼容性差。WSL2凭借原生Linux内核、GPU直通与文件系统互通能力,成为RFIC工程师在Windows平台构建生产级EDA环境的关键技术路径。其核心价值在于打通Cadence Virtuoso版图、SpectreRF仿真引擎与Python/scikit-rf数据分析的闭环流程,同时支持MATLAB与WSL间高效交换S参数等复数数据。典型应用场景包括毫米波芯片后仿真加速、高校轻量电磁建模及数字

weixin_29176179的博客 427

线段树开新坑:kuangbin带你飞

写在最前面的废话这里I以前的题是暑假刚刚开始的时候在家写的,然后多校一波就荒废了9月开头回家一波,重新填坑,= =,kuangbin带你飞的pdf,这才一半题,后面还有一波,蓝瘦,慢慢写吧,不写题怎么变的更强线段树基础单点更新A:hdu1166敌兵布阵:单点增减,区间sumcmy曾经这题疯狂TLE后来发现是因为cin的原因,cin好慢的说树状数组也可以做,zkw的暴力单点修改也可加速一波树状数组#i

cww97的博客 700

YOLOv11n-seg 实战指南:从训练到模型部署的完整流程

本文提供了YOLOv11n-seg实例分割模型从环境准备、数据标注到模型训练、验证及最终部署的完整实战指南。详细讲解了如何准备多边形掩码数据、配置关键训练参数、解读分割核心评估指标,并重点介绍了将模型导出为ONNX等格式进行部署的流程与优化技巧,帮助开发者高效完成从开发到生产的全链路实践。

weixin_29062255的博客 559

模拟退火算法 POJ 2420

【前言】先说一说什么是模拟退火,感觉很多地方都讲得挺神秘的,其实非常简单。 【模拟退火算法】转自点击打开链接 1. 模拟退火算法认识      爬山算法也是一个用来求解最优化问题的算法,每次都向着当前上升最快的方向往上爬,但是初始化不同可能    会得到不同的局部最优值,模拟退火算法就可能跳出这种局部最优解的限制。模拟退火算法是模拟热力学系统    中的退火过程。在退火过程中是

I good vegetable a! 3076

智慧安防:基于Java+YOLOv8的视频AI识别平台设计与实现

张工,我们的园区智慧安防项目又出问题了!用Python写的YOLOv8 demo,拉3路RTSP流就卡,视频延迟超过5秒,入侵检测误报率太高,一到晚上光线差就全是误报,而且和我们的Java安防平台对接太麻烦,还要搭个消息队列,架构复杂得要死!“别慌,用Java+YOLOv8啊!

2601_94871597的博客 199

人形机器人构成及成本估算(附报告)

这些执行器本身由螺杆、减速器、电机、传感器、滚珠轴承和编码器等组件构成。实现线性与旋转运动互转。人形机器人的运动系统可以由电驱动、液压驱动或气动驱动组成,但由于电驱动具有更高的精度和更快的响应速度,正在成为主流设计方案。执行器:NSK、THK、Harmonic Drive、Leaderdrive、Nidec、Moons。由螺杆、减速器、电机、传感器、轴承和编码器组成(如上为Tesla Optimus执行器设计示意)。传感器:Keyence、Robosense、Sensata、ATI、TE、Sony。

具身机器人和通用AI 1789

POJ 3074 DLX精确覆盖求解数独问题

【解题方法】             DLX解决9*9的数独问题,转化为729*324的精确覆盖问题             行:                   一共9 * 9 * 9 == 729行。一共9 * 9小格,每一格有9种可能性(1 - 9),每一种可能都对应着一行。             列:                   一共(9 + 9 + 9)

I good vegetable a! 1556

【华为OD机考真题】- 构成的正方形数量(B卷-100分)(Java版)

🔔本文收录于「最新最全华为OD机试真题(Java版)」专栏,手把手带你零基础教学华为OD机试。本题集提供最优题解思路,解题步骤,代码解析,复杂度分析及最优题解源码等,支持多语言题解,助你轻松拿捏OD机考,一举上岸!安利大家关注&&收藏&&订阅!题库正在疯狂收录中,up!up!up!! 🚫提醒:拒绝一切代考/替考,违法必究!专栏所写题库均精心搜集于互联网,经过精心筛选和整理,结合数位十多年大厂实战经验资深大佬经验所撰,欢迎订阅。    💗订阅福利:一次订阅,可永久免费阅读,提供在线答疑解惑,后续题库更新

**My Coding Family** 1352

51 nod 1376 最长递增子序列的数量(二维偏序cdq)

【题意】求一个序列中LCS的数量? 【解题方法1】f[i]:以第i个数结尾的LCS的长度,和该长度的LIS的数量,转移的话,显然f[i].first=max(f[j].first)+1,j 【AC代码】 //51nod //LCS CDQ/BIT #include #include #include #include #include using namespace std; co

I good vegetable a! 1366

IMSL CNL 7.0.0 (x86-64)Crack

IMSL CNL 7.0.0 (x86-64)Crack intel的算法库破解文件,这是C++版本的破解文件

RU DOS版、EFI版32bit/64bit BIOS常用工具

DOS版、EFI版的RU工具,可用来查看IO、MEM、PCI、SMBIOS等资源。亲测在EFI SHELL下可用。

BZOJ 4653: [Noi2016]区间

Description 在数轴上有 n个闭区间 [l1,r1],[l2,r2],...,[ln,rn]。现在要从中选出 m 个区间,使得这 m个区间共同包含至少一个位置。换句话说,就是使得存在一个 x,使得对于每一个被选中的区间 [li,ri],都有 li≤x≤ri。 对于一个合法的选取方案,它的花费为被选中的最长区间长度减去被选中的最短区间长度。区间 [li,ri] 的长度定义为 ri−

I good vegetable a! 1181

假人有限元模型

假人模型,车辆碰撞假人有限元模型,适合做乘员安全的研究者利用

线段树离线 SWUST OJ 2459 Submissions of online judge

【题意】维护一个区间不同的数的个数。 【解题方法】首先我们把所有查询区间记录下来,然后按照区间的右值排序,接着从左到右把每一个数更新到线段树中,并记录它出现的位置。如果一个数已经出现过,那么我们就把他上次出现的位置的值置为0,并更新它出现的位置。因为我们的查询区间是按右值排序的,因此把过去重复出现的数字置为0不会影响结果。当更新到某个区间的右值时,我们就查询一次该区间的答案,并把答案记下来。最后

I good vegetable a! 1098

Probability and Statistics - 4th edition

Probability and Statistics - 4th edition

Uva Recurrences 矩阵优化

Consider recurrent functions of the following form:f(n) = a1f(n − 1) + a2f(n − 2) + a3f(n − 3) + … + adf(n − d), for n > d, where a1, a2, … , ad are arbitrary constants. A famous example is the Fibon

I good vegetable a! 1076

HUST 1017 Exact cover(舞蹈链 入门题)(模板记录)

【题意】不解释了,就是裸的DLX模板题,先记录一下DLX的板子,看了半天总算理解了一些。 【DLX学习】参考这篇博客:点击打开链接 写得非常清楚,顺便赞一句,DLX真的是太神奇了。orz。 【AC 代码 DLX 模板】 /********************/ //Created by just_sort 2016/8/13 //All Rights Reserved. //Dancin

I good vegetable a! 1061

HDU.4605 Magic Ball Game

【题意】            多校的一个题目。            根为1的N            每碰到一个球,有3种情况:           1:如果此球重量等于该节点重量或者没有儿子节点了,球就停下了           2:如果此球重量小于该节点重量,则分别往左右儿子走的可能都是1/2           3:如果此球重量大于该节点重量,则走向左儿子的概率是1/8,

I good vegetable a! 939

SWUST 2268 SB_cyh and his BST two (Treap名次树)

Input 多组数据(整个文件以输入 -1 结束) 对于每组数据,有若干行(最多100000行),表示的意义如下: 【A】 insert x 【B】 delete x 【C】 predecessor x 【D】 successor x 【E】 Kth x 【F】 rank x 这6种操作的意义与上面的定义相对应! 【G】 print 表示从小到大输出序列中的所有元素 【H】 en

I good vegetable a! 914

双剑合并 XOR Trie.

【题意】给你两行数,一行n个,一行m个,现在要你分别在这n个和m个里面找出1个,使得它们的异或和最大! 【分析】典型的XOR Trie.枚举一行数,另一行用XOR Trie存起来,然后这样就可以很快查询了。 【AC代码】 #include #include #include #include using namespace std; const int N = 1e7+2; stru

I good vegetable a! 914

POJ 2763 Housewife Wind 两种解法

Housewife Wind Time Limit: 4000MS   Memory Limit: 65536K Total Submissions: 9637   Accepted: 2642 Description After their royal wedding, Jiajia and Wind hid away in XX Vi

I good vegetable a! 872

POJ 2823

【题意】给定一个大小已知的数组以及一个大小已知的滑动窗口,窗口每个时刻向后移动一位,求出每个时刻窗口中数字的最大值和最小值。 【分析】第一分单调队列优化的入门题,思路很简单,这里就是维护一个长度最长为k的递增和递减的单调队列! 【AC代码】 // cpp~ //queue dp #include #include using namespace std; const int maxn =

I good vegetable a! 856

UVA 11297 Census(2D线段树解决子矩阵的最大最小)

【题意】给了一个n*n的矩阵,有两种操作,一种是更新矩形里面某个点的值,一种是查询一个子矩阵的最大和最小值。 【解题方法】2D线段树裸题了。直接上代码了。 // //Created by just_sort 2016/9/16 14:25 //Copyright (c) 2016 just_sort.All Rights Reserved // //2D segment tree. #inc

I good vegetable a! 853

HDU 4007 Dave (线段树扫描线 或 暴力+双扫描线)

【题意】给了n个点,求一个正方形能围住的最大点数,同样正方形平行于坐标轴。 【解题方法1】线段树+扫描线。AC时间:30ms。 // //Created by just_sort 2016/12/3 //Copyright (c) 2016 just_sort.All Rights Reserved // #include #include #include #include #

I good vegetable a! 846
上一篇: HDU 3085
下一篇: ZOJ 1610 Count the Colors(线段树,成段更新染色)
just_sort
博客等级 码龄11年 2360粉丝 1667原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值