上一页 1 2 3 4 5 6 7 ··· 13 下一页
摘要: https://codeforc.es/problemset/problem/1216/F 有直线上n个位置,每个位置上可以花费i的代价使得联网,某些位置可以放置路由器,放路由器的代价也是i,放置了路由器以后,可以让[i-k,i+k]的范围内上网,要求每台电脑都可以上网,最少需要多少代价。 思路: 阅读全文
posted @ 2019-09-28 01:07 zjxxcn 阅读(286) 评论(0) 推荐(0) 编辑
摘要: https://codeforc.es/problemset/problem/1216/E2 同e1,由于k最大是$10^{18}$,所以我们不能预处理,只能每次二分的时候临时去计算。 1 #include <bits/stdc++.h> 2 using namespace std; 3 #defi 阅读全文
posted @ 2019-09-27 22:47 zjxxcn 阅读(175) 评论(0) 推荐(0) 编辑
摘要: https://codeforc.es/problemset/problem/1216/E1 求1121231234...序列里面第k个数字,k不超过10亿。 我们只要预处理一个sum数组,然后每次二分一下(其实不二分也可以) 1 #include <bits/stdc++.h> 2 using n 阅读全文
posted @ 2019-09-27 22:44 zjxxcn 阅读(168) 评论(0) 推荐(0) 编辑
摘要: https://codeforc.es/problemset/problem/1216/D 贪心: 找出最大的a[i],令为t,即假设这个t就是原来的x 然后b[i]=t-a[i]; b[i]表示每个缺了的数量。 最后求一个所有b[i]的最大公约数。 答案就是累加b[i]/gcd 1 #includ 阅读全文
posted @ 2019-09-27 13:18 zjxxcn 阅读(189) 评论(0) 推荐(0) 编辑
摘要: https://codeforc.es/problemset/problem/1216/C 判断一个矩形是否被另外两个矩形完全覆盖,这题是我是用离散化的方法来做的。 1 #include<bits/stdc++.h> 2 using namespace std; 3 int x[7],y[7],tx 阅读全文
posted @ 2019-09-26 22:56 zjxxcn 阅读(209) 评论(0) 推荐(0) 编辑
摘要: https://codeforc.es/problemset/problem/1216/B 这题还是贪心,直接排序即可 。 1 #include<bits/stdc++.h> 2 using namespace std; 3 int const N=1000+10; 4 int a[N],n,b[N 阅读全文
posted @ 2019-09-26 22:14 zjxxcn 阅读(175) 评论(0) 推荐(0) 编辑
摘要: https://codeforc.es/problemset/problem/1216/A 本题直接$O(n)$贪心。 1 #include<bits/stdc++.h> 2 using namespace std; 3 int const N=200000+10; 4 char s[N]; 5 i 阅读全文
posted @ 2019-09-26 22:04 zjxxcn 阅读(146) 评论(0) 推荐(0) 编辑
摘要: 这是一道被离线爆艹的模板题。 你要维护一张无向简单图。你被要求加入删除一条边及查询两个点是否连通。 0:加入一条边。保证它不存在。 1:删除一条边。保证它存在。 2:查询两个点是否联通。 本题解法: 1.lct 2.对操作进行分块,然后维护并查集(需要回到过去)。 时间复杂度$O(m*sqrt(m) 阅读全文
posted @ 2019-09-21 01:23 zjxxcn 阅读(402) 评论(0) 推荐(0) 编辑
摘要: http://codeforces.com/problemset/problem/1217/E 这题的思路是: 1.首先不能有进位 2.由于要求和最小,所以我们只要选择两个数就可以了。 1 #include<bits/stdc++.h> 2 using namespace std; 3 int co 阅读全文
posted @ 2019-09-21 01:17 zjxxcn 阅读(160) 评论(0) 推荐(0) 编辑
摘要: http://codeforces.com/problemset/problem/1217/D 这题的思路是构造,我们可以知道颜色最多只需要两种,然后按照dfs的顺序。 1 #include<bits/stdc++.h> 2 using namespace std; 3 int const N=50 阅读全文
posted @ 2019-09-21 01:14 zjxxcn 阅读(246) 评论(0) 推荐(0) 编辑
摘要: 这是一个好题,感觉是noi2018里面最好的题目,考验打表能力,动态规划和对卡特兰数的理解。 1 #include<bits/stdc++.h> 2 using namespace std; 3 int const N=1000000+10; 4 int const mod=998244353; 5 阅读全文
posted @ 2019-09-17 23:43 zjxxcn 阅读(132) 评论(0) 推荐(0) 编辑
摘要: 1856: [Scoi2010]字符串 Description lxhgww最近接到了一个生成字符串的任务,任务需要他把n个1和m个0组成字符串,但是任务还要求在组成的字符串中,在任意的前k个字符中,1的个数不能少于0的个数。现在lxhgww想要知道满足要求的字符串共有多少个,聪明的程序员们,你们能 阅读全文
posted @ 2019-09-17 23:41 zjxxcn 阅读(217) 评论(0) 推荐(0) 编辑
摘要: 题目链接 题目大意:有n个地方需要通讯,每个地方可以用两种基站里面的其中一种,有p种基站, 每种基站能够接收的频率在l到r范围内,最大的频率是M,有m对基站会相互干扰,所以不能同时选。 要求一种频率,使得每个地方都能通讯。 输出使用的频率和哪几个基站。 题目分析: 这题明显可以用2sat来做,但是我 阅读全文
posted @ 2019-09-17 23:36 zjxxcn 阅读(233) 评论(0) 推荐(0) 编辑
摘要: https://blog.csdn.net/hwzzyr/article/details/81190442 阅读全文
posted @ 2019-09-12 14:39 zjxxcn 阅读(90) 评论(0) 推荐(0) 编辑
摘要: Description 给你N个点的无向图 (1 <= N <= 15,000),记为:1…N。 图中有M条边 (1 <= M <= 30,000) ,第j条边的长度为: d_j ( 1 < = d_j < = 1,000,000,000). 现在有 K个询问 (1 < = K < = 20,000 阅读全文
posted @ 2019-09-12 14:37 zjxxcn 阅读(105) 评论(0) 推荐(0) 编辑
摘要: 3545: [ONTAK2010]Peaks Description 在Bytemountains有N座山峰,每座山峰有他的高度h_i。有些山峰之间有双向道路相连,共M条路径,每条路径有一个困难值,这个值越大表示越难走,现在有Q组询问,每组询问询问从点v开始只经过困难值小于等于x的路径所能到达的山峰 阅读全文
posted @ 2019-09-12 14:34 zjxxcn 阅读(209) 评论(0) 推荐(0) 编辑
摘要: 3551: [ONTAK2010]Peaks加强版 Description 【题目描述】同3545 【题目描述】同3545 Input 第一行三个数N,M,Q。 第二行N个数,第i个数为h_i 接下来M行,每行3个数a b c,表示从a到b有一条困难值为c的双向路径。 接下来Q行,每行三个数v x 阅读全文
posted @ 2019-09-12 14:32 zjxxcn 阅读(295) 评论(0) 推荐(0) 编辑
摘要: 题目描述 本题的故事发生在魔力之都,在这里我们将为你介绍一些必要的设定。 魔力之都可以抽象成一个 n 个节点、m 条边的无向连通图(节点的编号从 1 至 n)。我们依次用 l,a 描述一条边的长度、海拔。 作为季风气候的代表城市,魔力之都时常有雨水相伴,因此道路积水总是不可避免 的。由于整个城市的排 阅读全文
posted @ 2019-09-12 14:29 zjxxcn 阅读(136) 评论(0) 推荐(0) 编辑
摘要: It is vitally important to have all the cities connected by highways in a war. If a city is conquered by the enemy, all the highways from/toward that 阅读全文
posted @ 2019-09-11 11:02 zjxxcn 阅读(566) 评论(0) 推荐(0) 编辑
摘要: As the manager of your company, you have to carefully consider, for each project, the time taken to finish it, the deadline, and the profit you can ga 阅读全文
posted @ 2019-09-11 11:02 zjxxcn 阅读(267) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 ··· 13 下一页