随笔分类 - 优先队列————
摘要:C-3 SRM 08 描述 给一个图,n 个点 m 条双向边,每条边有其长度。n 个点中有 k 个是特殊点,问任意两个特殊点的最短路是多少。 输入格式 第一行三个整数 n m k 第二行 k 个整数 ,为各个特殊点 接下来 m 行,每行三个整数 x y d,表示 x 到 y 有一条长度为 d 的边
阅读全文
摘要:2590: [Usaco2012 Feb]Cow Coupons Description Farmer John needs new cows! There are N cows for sale (1 <= N <= 50,000), and FJ has to spend no more tha
阅读全文
摘要:T1 金币 题目传送门 就是道模拟题咯 #include<cstdio> #include<cstring> #include<algorithm> using namespace std; int read(){ int ans=0,f=1,c=getchar(); while(c<'0'||c>
阅读全文
摘要:IPCTRAIN: 训练营教练题目描述 本次印度编程训练营(Indian Programming Camp,IPC)共请到了 N 名教练。训练营的日 程安排有 M 天,每天最多上一节课。第 i 名教练在第 Di 天到达,直到训练营结束才离开。第 i 名 教练希望上 Ti 节课。要是少上了课,那么教练
阅读全文
摘要:题目传送门 这道题就贪心.... 正的一坨和负的一坨间隔 #include<cstdio> #include<cstring> #include<algorithm> #include<queue> #include<cmath> #include<cstdlib> #define LL long
阅读全文
摘要:题目传送门 这道题很容易想到优先把两堆重量最小的合并比较优 然后乱搞一下就可以啦 #include<cstdio> #include<cstring> #include<algorithm> #include<queue> using namespace std; int read(){ int a
阅读全文
摘要:题目传送门 用优先队列瞎搞... 想着在每个地方 先算上一个点到这一个点要花费多少钱 这个用小根堆算就好 然后在这个地方加油 把油钱比自己多的替代掉 这个用大根堆维护一下 然后两个堆之间信息要保持互通 这个有点麻烦 我用的f数组维护 这样就好了 中间懒得改全部开了long long 不要介意 #in
阅读全文

浙公网安备 33010602011771号