树状数组自学笔记
先看例题 P3374 【模板】树状数组 1 。对于一个数列,我们需要支持以下两个操作:
安吉之行
CF1693B Fake Plastic Trees 题解
t 组数据,每组给定一个 n 个结点的树, 根为 1 ,给定 2,3,\ldots ,n 的父结点 p_2,p_3,\ldots ,p_n 。再给出每个点权值 a_i 的范围 [l_i,r_i] 。
1. 运动的描述
C# WinForm 实战:随机点号器
//使用: resultnum = GetConnectionString(“maxnumber”); resultstr = GetConnectionString(“maxstring”);</pre>
利用onenote-dump将OneNote笔记转换成markdown文件
Codeforces DP1400 题 大赏
高一数学 第一章 集合与常用逻辑用语 笔记整理
[CSP-S 2021] 回文
Dijkstra 入门
using namespace std; int n,m,s; struct node{ int a,val; bool operator < (node b) const{ return val>b.val; } }; vector <node> G[100010]; priority_queue <node> q; int dis[100010]; int main(){ cin>>n>>m>>s; int a,b,c; for(int i=1;i<=m;i++){ cin>>a>>b>>c; G[a].push_back({b,c}); } q.push({s,0}); memset(dis,0x3f,sizeof dis); dis[s]=0; while(!q.empty()){ node now=q.top(); q.pop(); if(now.val!=dis[now.a])continue; for(int i=0;i <g[now.a].size();i++){ node="" nxt=“G[now.a][i];” if(dis[nxt.a]=""> dis[now.a]+nxt.val){ q.push({nxt.a,dis[now.a]+nxt.val}); dis[nxt.a]=now.val+nxt.val; } } } for(int i=1;i<=n;i++){ cout< <dis[i]<<” ”;="" }="" return="" 0;="" }<="" re="">
Profile Image of the Author
Dignite
技术,学习,生活,旅行。
公告
欢迎来到我的博客!这是一则示例公告。
分类
标签
站点统计
文章
151
分类
5
标签
282
总字数
319,025
运行时长
0
最后活动
0 天前

目录