上一页 1 ··· 9 10 11 12 13 14 15 下一页
摘要: POJ3057 Evacuation 二分图匹配+最短路 题目描述 Fires can be disastrous, especially when a fire breaks out in a room that is completely filled with people. Rooms us 阅读全文
posted @ 2020-05-13 22:52 liuchanglc 阅读(264) 评论(0) 推荐(1) 编辑
摘要: 题目描述 FJ's N (1 ≤ N ≤ 10,000) cows conveniently indexed 1..N are standing in a line. Each cow has a positive integer height (which is a bit of secret). 阅读全文
posted @ 2020-05-12 23:21 liuchanglc 阅读(140) 评论(0) 推荐(0) 编辑
摘要: 题目描述 这是一个简单的游戏,在一个n n的矩阵中,找n个数使得这n个数都在不同的行和列里并且要求这n个数中的最大值和最小值的差值最小。 Input 输入一个整数T表示T组数据。 对于每组数据第一行输入一个正整数n(1 include include include include include 阅读全文
posted @ 2020-05-12 23:13 liuchanglc 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 洛谷 P2220 [HAOI2012]容易题 题目描述 为了使得大家高兴,小Q特意出个自认为的简单题(easy)来满足大家,这道简单题是描述如下: 有一个数列A已知对于所有的A[i]都是1~n的自然数,并且知道对于一些A[i]不能取哪些值,我们定义一个数列的积为该数列所有元素的乘积,要求你求出所有可 阅读全文
posted @ 2020-05-12 19:16 liuchanglc 阅读(164) 评论(0) 推荐(0) 编辑
摘要: 题目连接:传送门 分析 这道题只看题目中给的样例是找不出规律的 所以我们可以打一下表 1, 2, 4, 5, 8, 10, 13, 14, 18 如果你还是没有看出什么规律的话,我们可以从OEIS上搜索一下 网址:传送门 把这一个数列输入到搜索框,然后就会出现下面的页面 传送门 第一个就是我们想要的 阅读全文
posted @ 2020-05-10 18:10 liuchanglc 阅读(196) 评论(0) 推荐(0) 编辑
摘要: 题目链接: "传送门" 分析 这道题乍看上去没有思路,但是我们仔细一想就会发现这道题其实是一个二分图最大匹配的板子 我们可以把这道题想象成将男生和女生之间两两配对,使他们的好感度最大 我们把矩阵中的元素$a[x][y]$看成女生$x$和男生$y$之间的好感度,跑一个KM算法 因为KM算法会维护$ex 阅读全文
posted @ 2020-05-10 17:26 liuchanglc 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 摘自:wenruo的博客 现在有N男N女,有些男生和女生之间互相有好感,我们将其好感程度定义为好感度,我们希望把他们两两配对,并且最后希望好感度和最大。 怎么选择最优的配对方法呢? 首先,每个女生会有一个期望值,就是与她有好感度的男生中最大的好感度。男生呢,期望值为0,就是……只要有一个妹子就可以啦 阅读全文
posted @ 2020-05-09 21:59 liuchanglc 阅读(398) 评论(0) 推荐(1) 编辑
摘要: 分析 这道题$n\leq10^{6}$,显然$n^{2}$的暴力是无法解决问题的 那么我们可以考虑数列的某一种性质 因为最终的答案是$\sum{n \atop i=1} |p_i i|$,和绝对值有关,所以我们把数列中的数分为两类 第一类是$p_i i 0$,第二类是$p_i i\leq0$ 我们可 阅读全文
posted @ 2020-05-09 12:21 liuchanglc 阅读(130) 评论(0) 推荐(0) 编辑
摘要: 题目描述 You are given a weighed undirected connected graph, consisting of n vertices and mm edges. You should answer q queries, the i-th query is to find 阅读全文
posted @ 2020-05-09 11:41 liuchanglc 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 题目描述 City C is really a nightmare of all drivers for its traffic jams. To solve the traffic problem, the mayor plans to build a RTQS (Real Time Query 阅读全文
posted @ 2020-05-06 18:25 liuchanglc 阅读(186) 评论(0) 推荐(2) 编辑
摘要: 题目描述 B君和G君聊天的时候想到了如下的问题。 给定自然数l和r ,选取2个整数x,y满足l using namespace std; typedef long long ll; int main(){ ll aa,bb,t; scanf("%lld",&t); while(t ){ scanf( 阅读全文
posted @ 2020-05-04 22:28 liuchanglc 阅读(194) 评论(0) 推荐(1) 编辑
摘要: 洛谷P3295 [SCOI2016]萌萌哒 题目描述 公式粘过来就乱了,还是去洛谷看题吧 分析 如果暴力解决的话就是使用并查集把位数相同的数位并在一起。比如区间[1,2]和区间[3,4]的数字完全相同,那么我们就把1和3并在一起,在把2和4并在一起,这样它们的祖先相同,就相当于把它们绑定在了一起,同 阅读全文
posted @ 2020-05-04 17:16 liuchanglc 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 题目描述 lxhgww最近迷上了一款游戏,在游戏里,他拥有很多的装备,每种装备都有2个属性,这些属性的值用[1,10000]之间的数表示。当他使用某种装备时,他只能使用该装备的某一个属性。并且每种装备最多只能使用一次。游戏进行到最后,lxhgww遇到了终极boss,这个终极boss很奇怪,攻击他的装 阅读全文
posted @ 2020-05-03 17:57 liuchanglc 阅读(209) 评论(0) 推荐(0) 编辑
摘要: A、POJ3159 Candies 题目描述 During the kindergarten days, flymouse was the monitor of his class. Occasionally the head-teacher brought the kids of flymouse 阅读全文
posted @ 2020-05-02 09:25 liuchanglc 阅读(167) 评论(0) 推荐(0) 编辑
摘要: //dfs预处理出每个节点的深度和2的x方级祖先节点 void dfs(int now,int fa,int da){ //now为当前节点,fa为父亲节点,da为父亲节点和儿子节点所连边的边权 cost[now][0]=da; zx[now][0]=fa; dep[now]=dep[fa]+1; 阅读全文
posted @ 2020-05-02 09:23 liuchanglc 阅读(119) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Ali has taken the Computer Organization and Architecture course this term. He learned that there may be dependence between instructions, like WAR 阅读全文
posted @ 2020-05-01 18:37 liuchanglc 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 确定比赛名次 题目大意 有N个比赛队(1 Sample Input 4 3 1 2 2 3 4 3 Sample Output 1 2 4 3 分析 比较裸的拓扑排序的题,唯一需要考虑的就是输出的顺序 不过这个也不难,用一个优先队列存一下就可以了 代码 cpp include include inc 阅读全文
posted @ 2020-05-01 17:07 liuchanglc 阅读(160) 评论(0) 推荐(0) 编辑
摘要: Electricity POJ - 2117 题目描述 Blackouts and Dark Nights (also known as ACM++) is a company that provides electricity. The company owns several power pla 阅读全文
posted @ 2020-05-01 16:29 liuchanglc 阅读(190) 评论(0) 推荐(0) 编辑
摘要: //Tarjan求割点 void tarjan(int now,int fa){ int num=0; low[now]=dfn[now]=++dfnc; for(int i=head[now];i!=-1;i=b[i].next){ int u=b[i].to; if(!dfn[u]){ tarj 阅读全文
posted @ 2020-05-01 11:14 liuchanglc 阅读(234) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Caocao was defeated by Zhuge Liang and Zhou Yu in the battle of Chibi. But he wouldn't give up. Caocao's army still was not good at water battles 阅读全文
posted @ 2020-05-01 10:37 liuchanglc 阅读(262) 评论(0) 推荐(0) 编辑
摘要: //Tarjan求桥 void tarjan(int now,int id){ dfn[now]=low[now]=++dfnc; for(int i=head[now];i!=-1;i=b[i].next){ if(i==(id^1)) continue; int u=b[i].to; if(!d 阅读全文
posted @ 2020-05-01 10:25 liuchanglc 阅读(179) 评论(0) 推荐(0) 编辑
摘要: //Tarjan求强连通分量 void tarjan(int now){ dfn[now]=low[now]=++dfnc; sta[++top]=now; for(int i=head[now];i!=-1;i=b[i].next){ int u=b[i].to; if(!dfn[u]){ tar 阅读全文
posted @ 2020-05-01 10:15 liuchanglc 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 题目描述 Farmer John正在一个新的销售区域对他的牛奶销售方案进行调查。他想把牛奶送到T个城镇 (1 6 3 3 4 1 2 5 3 4 5 5 6 10 3 5 100 4 6 100 1 3 10 样例输入解释:一共六个城镇。在1 2,3 4,5 6之间有道路,花费分别是5,5,10。同 阅读全文
posted @ 2020-04-30 11:55 liuchanglc 阅读(208) 评论(1) 推荐(1) 编辑
摘要: 题目描述 Although Inzane successfully found his beloved bone, Zane, his owner, has yet to return. To search for Zane, he would need a lot of money, of whi 阅读全文
posted @ 2020-04-30 08:54 liuchanglc 阅读(135) 评论(0) 推荐(0) 编辑
摘要: 题目描述 你有 1020 个格子,它们从 0 开始编号,初始时所有格子都还未染色,现在你按如下规则对它们染色: 1. 编号是 p1 倍数的格子(包括 0号格子,下同)染成红色。 2. 编号是 p2 倍数的格子染成蓝色。 3. 编号既是 p1 倍数又是 p2 倍数的格子,你可以选择染成红色或者蓝色。 阅读全文
posted @ 2020-04-27 23:05 liuchanglc 阅读(206) 评论(0) 推荐(1) 编辑
上一页 1 ··· 9 10 11 12 13 14 15 下一页