- 博客(31)
- 资源 (1)
- 收藏
- 关注
原创 E. Permutation Separation,Educational Codeforces Round 81 (Rated for Div. 2),线段树
E. Permutation Separationhttp://codeforces.com/contest/1295/problem/EYou are given a permutation p1,p2,…,pn (an array where each integer from 1 to n appears exactly once). The weight of the i-th ele...
2020-01-30 19:01:44 889 2
原创 D. Same GCDs, Educational Codeforces Round 81 (Rated for Div. 2),欧拉函数
D. Same GCDs, Educational Codeforces Round 81 (Rated for Div. 2)You are given two integers a and m. Calculate the number of integers x such that 0≤x<m and gcd(a,m)=gcd(a+x,m).Note: gcd(a,b) is th...
2020-01-30 01:23:05 342
原创 Educational Codeforces Round 81 (Rated for Div. 2)
Educational Codeforces Round 81 (Rated for Div. 2)http://codeforces.com/contest/1295A. Display The Number思路:首先位数越多越好,那么直接不断的填1,但是只剩3段可以点亮时在首位填个7比较好#include<bits/stdc++.h>using namespace std...
2020-01-30 01:20:58 3287
原创 HDU - 6035,点分治,组合计数
Colorful Treehttps://vjudge.net/problem/938230/originThere is a tree with n nodes, each of which has a type of color represented by an integer, where the color of node i is ci.The path between each...
2020-01-18 18:43:37 418
原创 HDU - 4812,点分治
D Treehttps://vjudge.net/problem/48318/originThere is a skyscraping tree standing on the playground of Nanjing University of Science and Technology. On each branch of the tree is an integer (The tre...
2020-01-18 12:43:22 538 1
原创 HDU - 5469,点分治,hash,先处理子树
Antonidashttps://vjudge.net/problem/HDU-5469Given a tree with N vertices and N−1 edges. Each vertex has a single letter Ci. Given a string S, you are to choose two vertices A and B, and make sure th...
2020-01-18 10:29:32 358
原创 CodeChef PRIMEDST,点分治,FFT
Prime Distance On Treehttps://vjudge.net/problem/149908/originProblem description.You are given a tree. If we select 2 distinct nodes uniformly at random, what’s the probability that the distance b...
2020-01-17 11:06:35 199
原创 HDU - 5977,点分治,状压
Garden of Edenhttps://vjudge.net/problem/550645/originWhen God made the first man, he put him on a beautiful garden, the Garden of Eden. Here Adam lived with all animals. God gave Adam eternal life....
2020-01-16 21:20:49 195
原创 HYSBZ 2152,点分治
聪聪可可聪聪和可可是兄弟俩,他们俩经常为了一些琐事打起来,例如家中只剩下最后一根冰棍而两人都想吃、两个人都想玩儿电脑(可是他们家只有一台电脑)……遇到这种问题,一般情况下石头剪刀布就好了,可是他们已经玩儿腻了这种低智商的游戏。他们的爸爸快被他们的争吵烦死了,所以他发明了一个新游戏:由爸爸在纸上画n个“点”,并用n-1条“边”把这n个“点”恰好连通(其实这就是一棵树)。并且每条“边”上都有一个数。...
2020-01-16 17:21:56 132
原创 POJ - 2114,点分治
BoatherdsBoatherds Inc. is a sailing company operating in the country of Trabantustan and offering boat trips on Trabantian rivers. All the rivers originate somewhere in the mountains and on their wa...
2020-01-16 17:00:53 150
原创 POJ - 1741,点分治
A - TreeGive a tree with n vertices,each edge has a length(positive integer less than 1001).Define dist(u,v)=The min distance between node u and v.Give an integer k,for every pair (u,v) of vertices...
2020-01-16 16:11:01 133
原创 P3806 【模板】点分治1
P3806 【模板】点分治1给定一棵有 nn 个点的树。询问树上距离为 kk 的点对是否存在。思路:点分治,先选取一个重心root,算出每个点到它的距离,从而可以通过枚举两条路径能够组成的 询问距离 的次数,但是这样会将同一子树上的两条路径算上(即路径长度加上了两倍子节点到root的距离),将这种情况的贡献减去即可,这样就O(n)计算出了一颗经过root点的路径贡献,之后同样的对root的每...
2020-01-16 15:39:56 160
原创 A. Deadline,数论分块
Educational Codeforces Round 80 (Rated for Div. 2) A. Deadlinehttps://codeforces.com/contest/1288/problem/A思路:⌈dx+1⌉=⌊d+xx+1⌋=1+⌊d−1x+1⌋\lceil \frac{d}{x+1} \rceil=\lfloor\frac{d+x}{x+1}\rfloor=1+\...
2020-01-16 10:21:53 361
原创 C. Two Arrays,组合数学
C. Two Arrayshttps://codeforces.com/contest/1288/problem/CYou are given two integers n and m. Calculate the number of pairs of arrays (a,b) such that:the length of both arrays is equal to m;each e...
2020-01-16 10:18:41 549
原创 Gym 101190D,上下界区间覆盖
Delight for a CatA cat is going on an adventure.Each hour, the cat can be either sleeping or eating. The cat cannot be doing both actions at the samehour, and the cat is doing exactly one of these ...
2020-01-15 23:13:45 169
原创 POJ - 1815,动态修改容量最大流,字典序最小割集
FriendshipIn modern society, each person has his own friends. Since all the people are very busy, they communicate with each other only by phone. You can assume that people A can keep in touch with p...
2020-01-15 19:37:14 318
原创 POJ - 1815,字典序最小割集
FriendshipIn modern society, each person has his own friends. Since all the people are very busy, they communicate with each other only by phone. You can assume that people A can keep in touch with p...
2020-01-15 16:44:41 205
原创 HYSBZ 1061,线性规划转最小费用流
志愿者招募申奥成功后,布布经过不懈努力,终于成为奥组委下属公司人力资源部门的主管。布布刚上任就遇到了一个难题:为即将启动的奥运新项目招募一批短期志愿者。经过估算,这个项目需要N 天才能完成,其中第i 天至少需要Ai 个人。 布布通过了解得知,一共有M 类志愿者可以招募。其中第i 类可以从第Si 天工作到第Ti 天,招募费用是每人Ci 元。新官上任三把火,为了出色地完成自己的工作,布布希望用...
2020-01-15 11:34:18 353
原创 Educational Codeforces Round 80 (Rated for Div. 2)
Educational Codeforces Round 80 (Rated for Div. 2)https://codeforces.com/contest/1288A. Deadline思路:先不看取顶符号,求一次导发现大概在d\sqrt{d}d左右达到最小值,再在两边找最小值即可#include<bits/stdc++.h>using namespace std;...
2020-01-15 01:07:59 210
原创 HYSBZ 1061,单纯形&对偶原理
志愿者招募申奥成功后,布布经过不懈努力,终于成为奥组委下属公司人力资源部门的主管。布布刚上任就遇到了一个难题:为即将启动的奥运新项目招募一批短期志愿者。经过估算,这个项目需要N 天才能完成,其中第i 天至少需要Ai 个人。 布布通过了解得知,一共有M 类志愿者可以招募。其中第i 类可以从第Si 天工作到第Ti 天,招募费用是每人Ci 元。新官上任三把火,为了出色地完成自己的工作,布布希望用...
2020-01-14 21:48:37 178
原创 UVALive - 3231,二分&最大流
Fair ShareYou are given N processors and M jobs to be processed. Two processors are specified to each job.To process the job, the job should be allocated to and executed on one of the two processors...
2020-01-14 21:38:00 133
原创 Gym 101981I 最大流
Magic PotionThere are n heroes and m monsters living in an island. The monsters became very vicious these days,so the heroes decided to diminish the monsters in the island. However, the i-th hero ca...
2020-01-14 21:30:44 193
原创 HYSBZ 1497 最大权闭合图
最大获利新的技术正冲击着手机通讯市场,对于各大运营商来说,这既是机遇,更是挑战。THU集团旗下的CS&T通讯公司在新一代通讯技术血战的前夜,需要做太多的准备工作,仅就站址选择一项,就需要完成前期市场研究、站址勘测、最优化等项目。在前期市场调查和站址勘测之后,公司得到了一共N个可以作为通讯信号中转站的地址,而由于这些地址的地理位置差异,在不同的地方建造通讯中转站需要投入的成本也是不一样的,...
2020-01-14 21:17:06 115
原创 POJ 3680 区间k覆盖
IntervalsYou are given N weighted open intervals. The ith interval covers (ai, bi) and weighs wi. Your task is to pick some of the intervals to maximize the total weights under the limit that no poin...
2020-01-14 20:39:50 138
原创 HDU 5909,FWT
Tree CuttingByteasar has a tree T with n vertices conveniently labeled with 1,2,…,n. Each vertex of the tree has an integer value vi.The value of a non-empty tree T is equal to v1⊕v2⊕…⊕vn, where ⊕ d...
2020-01-14 00:06:46 213
原创 E - Delete a Segment
E - Delete a Segmenthttps://codeforces.com/contest/1285/problem/EThere are n segments on a Ox axis [l1,r1], [l2,r2], …, [ln,rn]. Segment [l,r] covers all points from l to r inclusive, so all x such ...
2020-01-12 10:42:21 262
原创 Codeforces Round #613 (Div. 2)
Codeforces Round #613 (Div. 2)https://codeforces.com/contest/1285A. Mezo Playing Zoma直接输出n+1B. Just Eat It!题意:A获得的代价是所有a[i]之和,B获得的是a数组中任选一段的和的最大值,问A获得的代价是否严格大于B思路:首先令dp[i]为选取a[i]能够获得的最大代价,可以由dp[...
2020-01-11 10:41:44 193
原创 二分&01最短路
Telephone Lineshttps://vjudge.net/problem/12427/origin题意:有n个点m条边,每条边为双向且有一个权值,最多可以让k条边的权值变为0,现要最小化从n号点到1号点经过的边权的最大值思路1:首先设经过的边权的最大值为mid,我们二分这个mid值,mid值大时n到1的路径一定包含mid值小的路径,即满足单调性,所以问题转化为是否存在一种方案使得边...
2020-01-10 16:19:53 569
原创 分层图最短路
Telephone Lineshttps://vjudge.net/contest/350871#problem/L题意:有n个点m条边,每条边为双向且有一个权值,最多可以让k条边的权值变为0,现要最小化从n号点到1号点经过的边权的最大值思路1:将原图看作k+1层,每层有n个点,dis[u][j]dis[u][j]dis[u][j] 表示到第j层的第u号点的边权最大值,即为当有j条边的权值置...
2020-01-10 15:39:45 107
原创 分层图最短路
[SHOI2012]回家的路https://www.luogu.org/problem/P3831题意:轨道交通网络由2n条地铁线路构成,组成了一个n纵n横的交通网。如下图所示,这2n条线路每条线路都包含n个车站,而每个车站都在一组纵横线路的交汇处。只有部分车站可以进行换乘(即改变横纵移动方向),图中用方块标记。从一个车站到另一个车站需要花费2分钟,换乘需要花费1分钟,给你起点和终点,问最少需...
2020-01-10 15:19:01 159
原创 Dijkstra算法及证明
Dijkstra算法及证明问题描述有n个点,m条边,求长度为n的数组dis,其中dis[i]表示从源点s到点i的最短距离复杂度O(mlogn)O(mlogn)O(mlogn)算法步骤令dis[s] = 0,其余节点的dis为无穷大,并将节点s入队找出一个未被标记的,dis[x]最小的节点x,然后标记节点x遍历x的所有相邻边(x,y,z),若dis[y] > dis[x] +...
2020-01-09 15:00:00 1114
汇编语言编程全套(含DOS,debug.exe,exit.com,masm)
2018-10-11
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人