##[不是游戏](好的网站) [图论建图] (https://csacademy.com/app/graph_editor/) [指令集](https://ouuan.github.io/post/n%E6%96%B9%E8%BF%87%E7%99%BE%E4%B8%87-%E6%9A%B4%E5%8A%9B%E7%A2%BE%E6%A0%87%E7%AE%97%E6%8C%87%E4%BB%A4%E9%9B%86%E4%BC%98%E5%8C%96%E7%9A%84%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8/) [FHQ](https://www.luogu.com.cn/record/127353973) [???](https://www.luogu.com.cn/blog/llch01/dong-tai-kai-dian-xian-duan-shu-gai-liang-post) [珂朵莉](http://sukasuka-anime.com/) [强弱类型](https://my.minecraft.kim/tech/1279/%e8%ae%ba%e7%bc%96%e7%a8%8b%e7%95%8c%e7%9a%84%e6%97%a5%e7%bb%8f%e9%97%ae%e9%a2%98%ef%bc%9a%e5%88%b0%e5%ba%95%e5%a6%82%e4%bd%95%e5%8c%ba%e5%88%86%e9%9d%99%e6%80%81%e7%b1%bb%e5%9e%8b%e5%92%8c%e5%8a%a8/) [ACL](https://github.com/atcoder/ac-library) [十分钟邮箱](https://mailtemp.net/) [梯子](https://lfyszy.lanzouq.com/iYKzI1dqxdzc) [纪元战争](https://www.luogu.com.cn/paste/z1s0pg6a) [胎神游戏集](https://www.luogu.com.cn/blog/z1e2k3i4/#) [C++标准库](https://zh.cppreference.com) [Hornex](https://hornex.pro/) [压行机](https://mivik.gitee.io/compress) [badge钩子](https://www.luogu.com.cn/paste/q4lblyku) [hack哈希](https://codeforces.com/blog/entry/62393) [ACFJ 机惨质量评价系统](https://www.luogu.com.cn/paste/ec3451z0) [AI对比机](https://eitherchoice.com/fight/%E6%A5%9A%E9%BB%8E%E6%95%99%E8%82%B2-vs-%E6%B4%9B%E8%B0%B7%E7%BD%91%E6%A0%A1) [bing镜像](https://bing.imc.re/web/#/) [clang-c++](https://tio.run/#cpp-clang) [STL容器](https://wyqz.top/p/870124582.html) [神奇游戏](https://theresmoregame.g8hh.com/) [C++游戏](https://www.luogu.com.cn/discuss/610847?page=3) (https://note.ms/caddaddgame) [](https://codeforces.com/profile/用户名) [提问的智慧](https://www.luogu.com.cn/blog/StudyingFather/how-to-ask-questions-the-smart-way-luogu-edition) [WordPress搭建教程](https://zhuanlan.zhihu.com/p/37896471) [让我帮你百度一下](https://ffis.me/baidu/index.html?%E8%AE%A9%E6%88%91%E5%B8%AE%E4%BD%A0%E7%99%BE%E5%BA%A6%E4%B8%80%E4%B8%8B%E7%BD%91%E5%9D%80) [强制学术](https://greasyfork.org/zh-CN/scripts/448294-%E6%B4%9B%E8%B0%B7%E5%AD%A6%E6%9C%AF%E8%84%9A%E6%9C%AC ) [水题]( https://www.luogu.com.cn/paste/5nzi8ivr) [随机图指南](https://img.jitsu.top/#/instruction/) [luogu树](https://wyxkk.gitee.io/the-luogu-tree-zh/) [博客园简约主题](https://www.cnblogs.com/yjlaugus/p/11529055.html) [Mermaid教程](https://www.iodraw.com/codechart/tutorial/zh/flowchart.html#flowcharts) [别看题解](https://greasyfork.org/zh-CN/scripts/460752-%E5%88%AB%E7%9C%8B%E9%A2%98%E8%A7%A3) [NewBing教程](https://study.zwjjiaozhu.top/posts/new-bing.html) [算法大全](https://www.luogu.com.cn/blog/command-block/blog-suo-yin-zhi-ding-post) [建图](https://visualgo.net/zh/dfsbfs?slide=1) [FHQ扩展](https://www.luogu.com.cn/blog/85514/fhq-treap-xue-xi-bi-ji) 查看他人主页源代码`console.log(_feInstance.currentData.user.introduction)` [T神游戏合集](https://www.luogu.com.cn/blog/z1e2k3i4/#) # 收藏 ### [Top Tree](https://negiizhao.blog.uoj.ac/blog/4912) ### [指令集优化](https://ouuan.github.io/post/n%E6%96%B9%E8%BF%87%E7%99%BE%E4%B8%87-%E6%9A%B4%E5%8A%9B%E7%A2%BE%E6%A0%87%E7%AE%97%E6%8C%87%E4%BB%A4%E9%9B%86%E4%BC%98%E5%8C%96%E7%9A%84%E5%9F%BA%E7%A1%80%E4%BD%BF%E7%94%A8/) ### [数据生成](https://www.luogu.com.cn/paste/4em0stx6) ### [究极卡常](https://548999.blog.luogu.org/jiu-ji-ka-chang) ### [友链](https://548999.blog.luogu.org/you-lian) ### [查理线段树](https://www.luogu.com.cn/discuss/531072?page=2) ### [$\LaTeX$数学符号](https://www.luogu.com.cn/discuss/531072?page=2) ### [$\LaTeX$ 编辑器](https://www.latexlive.com/) ### [cps评测](https://www.arealme.com/click-speed-test/cn/) ### [rvalue's blog](https://blog.rvalue.moe) ### [图遍历工具](https://visualgo.net/zh/dfsbfs?slide=1) ### [FHQ-Treap](https://www.luogu.com.cn/blog/85514/fhq-treap-xue-xi-bi-ji) ### [STL教程](https://blog.csdn.net/qq_50285142/article/details/114026148) [教程](https://www.luogu.com.cn/blog/wugu-2333/exlg-an-zhuang-shi-yong-shuo-ming) [油猴](https://chrome.zzzmh.cn/info?token=dhdgffkkebhmkfjojejmpbldmpobfkfo) [Exlg](https://exlg.oss-cn-shanghai.aliyuncs.com/latest/dist/extend-luogu.min.user.js) [strat-luogu](https://userstyles.org/styles/userjs/235716/smart-luogu.user.js) [猫和老鼠](https://greasyfork.org/scripts/414985-%E6%B4%9B%E8%B0%B7%E5%A8%B1%E4%B9%90%E6%8F%92%E4%BB%B6-%E7%8C%AB%E5%92%8C%E8%80%81%E9%BC%A0/code/%E6%B4%9B%E8%B0%B7%E5%A8%B1%E4%B9%90%E6%8F%92%E4%BB%B6%C2%B7%E7%8C%AB%E5%92%8C%E8%80%81%E9%BC%A0.user.js) [万能搜索](https://greasyfork.org/scripts/442416-luogu-search-anywhere/code/Luogu%20Search%20AnyWhere.user.js) [文本选中复制](https://greasyfork.org/scripts/405130-%E6%96%87%E6%9C%AC%E9%80%89%E4%B8%AD%E5%A4%8D%E5%88%B6/code/%F0%9F%94%A5%F0%9F%94%A5%F0%9F%94%A5%E6%96%87%E6%9C%AC%E9%80%89%E4%B8%AD%E5%A4%8D%E5%88%B6%F0%9F%94%A5%F0%9F%94%A5%F0%9F%94%A5.user.js) # L_H_的收藏 #### $\textbf{\textsf{实用工具或新鲜东西}}$ [silk](http://weavesilk.com/) [图床1](https://imgse.com/) [图床2](https://imgurl.org) [新大陆](https://www.zhihu.com/question/293309623/answer/825659532) [OIerDb](https://bytew.net/OIer/) [鼠标指针](https://zhutix.com/tag/cursors/page/2/) [数学工具](https://www.desmos.com) [Editor(画图)](https://csacademy.com/app/graph_editor/) [制作思维导图](https://gitmind.cn/) [LaTeX公式大全](http://www.mohu.org/info/symbols/symbols.htm) [天体运行模拟器](https://cybermap.kaspersky.com/cn/) [在线音频格式转换](https://www.aconvert.com/cn/audio/) [LaTex数学公式大全](https://www.luogu.com.cn/blog/IowaBattleship/latex-gong-shi-tai-quan) [狗屁不通文章生成器](https://suulnnka.github.io/BullshitGenerator/index.html) [注册SPOJ(不用科学上网)](https://www.luogu.com.cn/paste/jq3nlpwu) #### $\textbf{\textsf{游戏中心}}$ [Ncase](https://ncase.me/) [Armor Games](https://armorgamesstudios.com) [Poki](https://poki.com) [FRVR](https://frvr.com) [网址之家](https://youquhome.com/page/1/) [某399](https://4399.com) #### $\textbf{\textsf{阅读性用品}}$ [漫岛](https://www.mandao.tv) [阿狸](https://www.alimanhua.com) [樱花](http://www.imomoe.in) [SCP基金会](https://scp-wiki-cn.wikidot.com/scp-series) #### $\textbf{\textsf{一些图片}}$ [有趣的动图](https://www.luogu.com.cn/blog/wen33/ge-zhong-you-qu-di-dong-tu) [Many Picture](https://wallhaven.cc/) [Kiaressy](https://wallhaven.cc/user/Kiaressy) [Good Picture!](https://api.nmb.show/1985acg.php) [小球动图](https://s4.ax1x.com/2022/02/10/HYNNZV.gif) #### $\textbf{\textsf{知识点 \& 实用技巧}}$ [对拍详解](https://www.cnblogs.com/EdisonBa/p/13509379.html#%E5%AF%B9%E6%8B%8D%E6%98%AF%E4%BB%80%E4%B9%88) [平衡树](https://www.luogu.com.cn/blog/85514/fhq-treap-xue-xi-bi-ji) [替罪羊树](https://www.luogu.com.cn/blog/Apocrypha/scapegoattree-yang-xie) [splay](https://www.luogu.com.cn/blog/tiger0132/slay-notes) #### $\textbf{\textsf{网页游戏}}$: [Draw a poeple](https://drawastickman.com) [天空有多高](http://www.secaibi.com/howbigisspace) [模拟WIN](http://www.windows93.net) [信任的进化](https://dccxi.com/trust/) [moomoo](https://moomoo.io) [吃鸡.io](https://zombsroyale.io) [猫国建设者](https://likexia.gitee.io/cat-zh/#) [教主的游戏](https://experience.alanwalker.no/) [开局一堆火,资源全靠···](https://www.xd0.com/admin/index.html?lang=cn) [膜拜Siyuan](https://lmoliver.github.io/mosiyuan/index.html) [OI版2048](https://www.ak-ioi.com/apps/oi-2048/) [名字竞技场](https://deepmess.com/namerena/#) [generals](http://generals.io/) [sans模拟器](http://jcw87.github.io/c2-sans-fight/) [YORG](https://yorg.io/) [尺规作图](https://www.euclidea.xyz/en/game/) [太空公司](https://likexia.gitee.io/spacecompany1/) [马里奥](http://taomi.com/mario/mario.html) [小霸王](http://lab.mkblog.cn/FCGames/#/) [切断它](https://slices.ovh/) [过关算我输](https://nazo.one-story.cn/) [孟坤实验室](http://lab.mkblog.cn/) [猜汉字](https://handle.antfu.me/) [2048](http://hczhcz.github.io/my-2048/index.html?t=%E5%9C%A8%E6%B4%9B%E8%B0%B7%E7%9A%84%E6%88%90%E9%95%BF%E4%B9%8B%E8%B7%AF&v2=%E6%96%B0&v4=%E8%8F%9C&v8=%E8%92%9F&v16=%E7%81%B0&v32=%E8%93%9D&v64=%E7%BB%BF&v128=%E6%A9%99&v256=%E7%BA%A2&v512=%E7%B4%AB&v1024=%E5%A4%A7&v2048=%E5%B7%A8&m=%E7%A5%9E&w=%E8%A2%AB%E6%8E%88%E4%BA%88+%E7%AE%A1%E7%90%86%E6%89%80%E6%9C%89+%E6%9D%83%E9%99%90%EF%BC%9B%E5%8E%9F%E5%9B%A0%E6%98%AF%EF%BC%9A%E5%A4%AA%E7%89%9B%E4%BA%86&o=%E8%A2%AB+%E6%92%A4%E9%94%80+%E8%BF%9B%E5%85%A5%E4%B8%BB%E7%AB%99+%E6%9D%83%E9%99%90%EF%BC%9B%E5%8E%9F%E5%9B%A0%E6%98%AF%EF%BC%9A%E5%A4%AA%E8%92%9F%E4%BA%86) [人生重开模拟器](http://liferestart.syaro.io/view/index.html) [蒟蒻](https://btfy.vercel.app/?q=5oiR5piv6JKf6JK75ZCX77yf) [球球](https://mope.io/) [酷跑](https://bonk.io/) [2048二](https://ak-ioi.com/apps/oi-2048/) [欢乐围猫](https://luogulo.gq/show.php?url=https://www.luogu.com.cn/discuss/1?page=1) [玩个锤子](https://www.zlap.io/) [小恐龙【新】](https://dinoswords.gg/) [圈地](https://splix.io/) [好van的](https://neal.fun/) [小蝌蚪](https://limax.io/) [贪吃蛇](http://slither.io/) [百度自动搜索](https://baidu.physton.com/?q%E7%99%BE%E5%BA%A6) [跳跳](https://pie.ai/) [琼脂细胞大作战](https://agar.io) [坦克大作战](https://diep.io) [florr](https://florr.io) #### 你谷 [小糯米写的小说](https://www.luogu.com.cn/blog/masterfufufu/#type=洛谷之光) [你谷词典](https://www.luogu.com.cn/blog/FCBM71/luogu-dictionary) [神贴大全](https://arachnidaqueen.blog.luogu.org/nei-suo-nian-di-shen-tie-shou-lu) [文文新闻](https://www.luogu.com.cn/paste/7rmu8xyr) [你谷QQ表情库](https://studyingfather.blog.luogu.org/qq-stickers) [算数入门](https://www.luogu.com.cn/paste/pwukvult) ## 美滋儿滋儿 老冯者持鸡羹入,见四座俨然,遂突发恶疾,嘻哈大笑。置羹于案,忽疑,环顾四座。问:“呜呼,菜已尽备,不食何为?” 一王姓队长曰:老冯,诸位皆不敢食。或曰毒于菜中。 冯笑曰:哎呦呦,速趁热食之,吾不相前扰,吾去也。 司令俨然曰:汝不可走 冯即曰:司令,汝不得相与王大队长兴口雌黄! 司令曰:吾信,信其极。 冯面有忧色,对曰:司令,汝也喜言戏乎? 司令持羹匙挹羹一碗,曰:汝未置毒与羹,即食之,不应露此难色。 老冯又笑曰:此羹乃珍馐,不应先与同志乎?吾不过一后厨,食不得,食不得。 司令曰:汝甚苦矣。食此羹亦何如? 稍止又曰:拒食,即置毒于此羹。 老冯对曰:今朝谁欲害余,乃队长否?善,吾食之。 老冯栗手持羹于前,壮胆,高声呼:食此羹,乃一桩美差是也! 老冯食毕曰:此羹味极,甚哉。 少倾曰:司令,视无事否?速趁热食之!汝需当首。若不为,众人何敢相食? 见众人对视,又曰:皆,皆何以视余?食,趁热食之。 四座俱寂,冯忽突发恶疾,敲案怒曰:他娘的,为何不食!不食,不食是否? 老冯掏雷曰:不食,吾灭众人也!胆小惧死否?吾言尽于此,不食,亦勿欲生! 两卫惊,司令作势止其动。 冯擎雷又曰:汝等既晓,此戏亦无需再优。吾乃重庆军统,同倭寇双料超级特工! 素摘帽,露其秃头,定神曰:代名穿山甲! 杜先生由余释之,羹中毒亦乃余所为,余既食羹,必死无疑,汝等不食,仍不可活!归野,天皇圣哉! 遂拉拴,见火星,即大笑。 片刻,忽不见火光,竟未爆也。冯大骇,怒曰:令奶的,何以行此勾当!余誓与汝等同归于尽也! 冯忽面有难色,口吐殷血,欲言不得。遂倒地身亡。 syz到此一游 #include <bits/stdc++.h> using namespace std; //思路:通过tarjan把连通分量的权值集中到根节点,把每个点的父节点存到数组fa里 //根据fa数组重新构建一个DAG图(原图可能有环) //最后拓扑排序,把权值集中到点上,找最大值 const int M = 100005,N=10005; struct Edge{ int from,to,next; }edges[M],edges2[M]; int n,m,numEdge,quan[N],sumqz[N],dfn[N],low[N],stk[N],instk[N],head[N],head2[N],fa[N]; int idx,top,rudu[N],ans; void addEdge(int u,int v) { numEdge++; edges[numEdge].from=u; edges[numEdge].to=v; edges[numEdge].next=head[u]; head[u]=numEdge; } void tarjan(int u) { dfn[u]=low[u]=++idx; stk[++top] = u;//u入栈 instk[u] = 1;//标记u已经在栈里了 for(int i=head[u];i;i=edges[i].next)//遍历u关联的其它点 { int v = edges[i].to; if(dfn[v]==0)//如果该点没有被访问过 { tarjan(v);//递归遍历 low[u]=min(low[u],low[v]);//回溯时更新low[u] } else if(instk[v]){//说明这是一个返祖边,祖先节点在栈里 low[u] = min(low[u],low[v]); } } if(dfn[u]==low[u])//说明找到了一个强连通分量 { int tmp; while((tmp=stk[top])!=u) { instk[stk[top]]=0;//让子树出栈 fa[stk[top--]]=u; quan[u]+=quan[tmp]; } instk[stk[top]] = 0;//该节点也出栈 fa[stk[top--]] = u; } } void topp()//拓扑排序 { queue<int> qq; //找入度为0的点 for(int i=1; i<=n; i++) if(rudu[i]==0&&fa[i]==i) //既要入度为0,又要是环的主点 { qq.push(i); sumqz[i]=quan[i]; } while(!qq.empty()){ int tmp = qq.front(); qq.pop(); for(int i=head2[tmp];i; i=edges2[i].next) { int v = edges2[i].to; sumqz[v]=max(sumqz[v],sumqz[tmp]+quan[v]);//点可重复走 rudu[v]--; if(rudu[v]==0) qq.push(v); } } for(int i=1; i<=n; i++) ans = max(ans,sumqz[i]); } int main() { scanf("%d%d",&n,&m);//n个点,m条边 for(int i=1; i<=n; i++) scanf("%d",&quan[i]);//输入每个点的权值 int u,v; for(int i=1; i<=m; i++){ scanf("%d%d",&u,&v); addEdge(u,v); } for(int i=1; i<=n; i++) if(!dfn[i]) tarjan(i); int numEdge2 = 0; for(int i=1; i<=m; i++)//构建新的图 { int x=fa[edges[i].from]; int y = fa[edges[i].to]; if(x!=y)//说明不是一个连通块里的 { edges2[++numEdge2].from=x; edges2[numEdge2].to=y; edges2[numEdge2].next=heard2[x]; head2[x]=numEdge2; rudu[y]++;//y的入度加1 } } topp();//调用拓扑排序 printf("%d",ans); return 0; }P4306
Note.ms
/ece5ef