原创 ZOJ-3732 Graph Reconstruction(判定无向图度数序列能否可图化)

Let there be a simple graph with N vertices but we just know the degree of each vertex. Is it possible to reconstruct the graph only by these informa...

2017-09-30 15:46:41

阅读数 1522

评论数 0

原创 HDU-5556 Land of Farms(无向图的最大独立集)

2015ACM/ICPC亚洲区合肥站 Farmer John and his brothers have found a new land. They are so excited and decide to build new farms on the land. The land is a r...

2017-09-29 13:45:31

阅读数 357

评论数 0

原创 CodeForces-540E Infinite Inversions(树状数组+离散化+加点)

There is an infinite sequence consisting of all positive integers in the increasing order: p = {1, 2, 3, ...}. We performed n swap operations with th...

2017-09-27 21:02:08

阅读数 152

评论数 0

原创 计蒜客-2017 ACM-ICPC 亚洲区(西安赛区)网络赛Trig Function(数学公式推理)

2017 ACM-ICPC 亚洲区(西安赛区)网络赛 f(cos(x))=cos(n∗x) holds for all xx. Given two integers nn and mm, you need to calculate the coefficient of x^mx ​m ​​ i...

2017-09-26 23:48:50

阅读数 119

评论数 0

原创 HDU-3416 Marriage Match IV(最短路+最大流)

Do not sincere non-interference。 Like that show, now starvae also take part in a show, but it take place between city A and B. Starvae is in city A ...

2017-09-25 12:55:23

阅读数 146

评论数 0

原创 HDU-5441 Travel(并查集)

2015 ACM/ICPC Asia Regional Changchun Online Jack likes to travel around the world, but he doesn’t like to wait. Now, he is traveling in the Undirect...

2017-09-22 14:52:26

阅读数 117

评论数 0

原创 计蒜客-2017 ACM-ICPC 亚洲区(西安赛区)网络赛E题Coin(概率、组合数学)

计蒜客-2017 ACM-ICPC 亚洲区(西安赛区)网络赛 Bob has a not even coin, every time he tosses the coin, the probability that the coin's front face up is \frac{q}...

2017-09-20 12:51:38

阅读数 241

评论数 0

原创 HDU-5934 Bomb(强连通分量缩点)

2016年中国大学生程序设计竞赛(杭州) There are NN bombs needing exploding. Each bomb has three attributes: exploding radius riri, position (xi,yi)(xi,yi) and lighti...

2017-09-20 11:03:51

阅读数 514

评论数 0

原创 HDU-5437 Alisha’s Party(STL+模拟)

2015 ACM/ICPC Asia Regional Changchun Online Princess Alisha invites her friends to come to her birthday party. Each of her friends will bring a gift...

2017-09-20 10:46:09

阅读数 184

评论数 0

原创 计蒜客-2017 ACM-ICPC 亚洲区(西安赛区)网络赛E题Maximum Flow(网络流打表找规律)

2017 ACM-ICPC 亚洲区(西安赛区)网络赛 Given a directed graph with nn nodes, labeled 0,1, \cdots, n-10,1,⋯,n−1. For each <i, j><i,j> satisfies 0 \le ...

2017-09-19 12:58:31

阅读数 574

评论数 0

原创 HDU-6214 Smallest Minimum Cut(最小割)

2017 ACM/ICPC Asia Regional Qingdao Online Consider a network $G=(V,E)$ with source $s$ and sink $t$. An s-t cut is a partition of nodes set $V$ into...

2017-09-18 13:24:32

阅读数 531

评论数 5

原创 HDU-5889 Barricade(最小割或最短路+最小割)

2016 ACM/ICPC Asia Regional Qingdao Online The empire is under attack again. The general of empire is planning to defend his castle. The land can be ...

2017-09-16 23:33:35

阅读数 154

评论数 0

原创 POJ-3264 Balanced Lineup(rmq模板题)

For the daily milking, Farmer John's N cows (1 ≤ N ≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of...

2017-09-15 13:06:22

阅读数 129

评论数 0

原创 POJ-1330 Nearest Common Ancestors(lca模板题)

In the figure, each node is labeled with an integer from {1, 2,...,16}. Node 8 is the root of the tree. Node x is an ancestor of node y if node x is ...

2017-09-15 12:55:14

阅读数 149

评论数 0

原创 HDU-5459 Jesus Is Here(思维递推)

2015 ACM/ICPC Asia Regional Shenyang Online I've sent Fang Fang around 201314 text messages in almost 5 years. Why can't she make sense of ...

2017-09-14 12:51:35

阅读数 153

评论数 0

原创 HDU-5855 Less Time, More profit(最大权闭合图+二分)

The city planners plan to build N plants in the city which has M shops. Each shop needs products from some plants to make profit of proiproi units. ...

2017-09-14 10:22:44

阅读数 136

评论数 0

原创 HDU-5858 Hard problem(数学公式、计算几何)

2016 Multi-University Training Contest 10 Give you the side length of the square L, you need to calculate the shaded area in the picture. The full c...

2017-09-14 01:49:50

阅读数 152

评论数 0

原创 HDU-5826 physics(物理定理+微分方程)

There are n balls on a smooth horizontal straight track. The track can be considered to be a number line. The balls can be considered to be particles...

2017-09-12 12:03:43

阅读数 173

评论数 0

原创 计蒜客-2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛G题Query on a strin(树状数组+暴力更新)

You have two strings S and T in all capitals. Now an efficient program is required to maintain a operation and support a query. The operation C i ch ...

2017-09-11 15:50:23

阅读数 156

评论数 0

原创 HDU-6205 card card card(思维+简单线段树)

2017 ACM/ICPC Asia Regional Shenyang Online As a fan of Doudizhu, WYJ likes collecting playing cards very much. One day, MJF takes a stack of cards ...

2017-09-11 13:27:18

阅读数 448

评论数 0

原创 HDU-6201 transaction transaction transaction(树形dp)

2017 ACM/ICPC Asia Regional Shenyang Online Kelukin is a businessman. Every day, he travels around cities to do some business. On August 17th, in mem...

2017-09-10 22:32:40

阅读数 157

评论数 0

原创 HDU-6198 number number number(打表找规律、矩阵快速幂)

2017 ACM/ICPC Asia Regional Shenyang Online We define a sequence FF: ⋅⋅ F0=0,F1=1F0=0,F1=1; ⋅⋅ Fn=Fn−1+Fn−2 (n≥2)Fn=Fn−1+Fn−2 (n≥2). Give you an...

2017-09-10 21:08:37

阅读数 228

评论数 0

原创 计蒜客-2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛J题Our Journey of Dalian Ends (最小费用最大流)

题意: 给定若干个城市,出发点为大连,目的地为西安,但是要求中途必须经过上海,并且图中每个城市只能经过一次,给出m条路(双向道路),走第i条路需要wi代价,求所有满足要求的方案中花费的最小代价,如果没有满足的方案,输出-1。 思路: 相当于求从大连到上海加上西安到上海花费的代价总和最小。所以就是最...

2017-09-09 21:36:04

阅读数 860

评论数 0

原创 计蒜客-2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛H题Skiing(拓扑序求DAG最长路)

题意: 给定一个有向无环图,求该图的最长路。 思路: 由于是有向无环图,所以最长路肯定是一个入度为0到出度为0的路径,拓扑序在确定当前点之前能够考虑到所有到它的情况,所以最后取个最值即可。 代码: #include using namespace std; const int inf = 0x3...

2017-09-09 19:50:51

阅读数 968

评论数 2

原创 计蒜客-2017 ACM-ICPC 亚洲区(乌鲁木齐赛区)网络赛F题Islands(有向图加最少的边变成强连通图)

题意: 给一个有向图,求至少添加多少条边能够变成强连通图(任意两点互相可达)。 思路: 其实是DAG的一个性质:对于一个有向无环图,若想让它成为强连通图,至少需要添加max(a, b)条边,其中a为入度为0的点的数量,b为出度为0的点的数量。 其实自己推一推也找不到反例,所以对有向图进行缩点后根据...

2017-09-09 19:06:31

阅读数 614

评论数 0

原创 HDU-5900 QSC and Master(区间DP)

Every school has some legends, Northeastern University is the same. Enter from the north gate of Northeastern University,You are facing the main bu...

2017-09-08 13:36:02

阅读数 129

评论数 0

原创 HDU-5773 The All-purpose Zero(LIS变形)

?? gets an sequence S with n intergers(0 < n <= 100000,0<= S[i] <= 1000000).?? has a magic so that he can change 0 to any interger(He doe...

2017-09-07 15:44:30

阅读数 133

评论数 0

原创 POJ-2976 Dropping tests(01分数规划入门)

In a certain course, you take n tests. If you get ai out of bi questions correct on test i, your cumulative average is defined to be. Given your test...

2017-09-07 12:08:21

阅读数 143

评论数 0

原创 51nod-1524 可除图的最大团(DP)

对于一般的图,最大团问题是一个NP-难的问题。然而,对于一些特殊的图,最大团问题可以有比较有效的解决方案。 关于最大团问题的概念,请百度之。^_^ 在一个正整数集合A上定义可除图。 A = {a1, a2, ..., an} ,图上的顶点就是集合A中的数字。两个数字 ai 和 aj (i ≠ ...

2017-09-07 11:18:53

阅读数 245

评论数 0

原创 HDU-6184 (无向图三元环计数)

Little A is an astronomy lover, and he has found that the sky was so beautiful! So he is counting stars now! There are n stars in the sky, and litt...

2017-09-06 17:19:53

阅读数 1253

评论数 1

原创 HDU-5754 Life Winner Bo(混合博弈)

Bo is a "Life Winner".He likes playing chessboard games with his girlfriend G. The size of the chessboard is N×MN×M.The top left corner i...

2017-09-05 14:57:40

阅读数 147

评论数 0

原创 HDU-5793 A Boring Question(打表找规律)

ou have to get the answer for each nn and mm that given to you. For example,if n=1n=1,m=3m=3, When k1=0,k2=0,k3=0,(k2k1)(k3k2)=1k1=0,k2=0,k3=0,(k2k...

2017-09-04 16:54:24

阅读数 121

评论数 0

原创 字符串hash

#include <bits/stdc++.h> #define ull unsigned long long using namespace std; const int N = 1e5+5; ull p[N], hash1[N], hash2[N], bas = 233; char...

2017-09-03 21:26:03

阅读数 111

评论数 0

原创 FZU-2205 据说题目很水(思维、完全二分图性质避免三元环)

Sunday最近对图论特别感兴趣,什么欧拉回路什么哈密顿回路,又是环又是树。在看完一本书后,他对自己特别有信心,便找到大牛牛犇犇,希望他出一题来考考自己。 在遥远的古代东方有N个城市,它们之间可以通过双向的道路相连。任意两个城市由不超过一条道路直接相连,而且没有城市的道路连向自身。但是牛犇犇是个纯...

2017-09-03 15:53:50

阅读数 256

评论数 0

原创 Gym-100342J Triatrip(求有向图三元环个数+bitset应用)

The travel agency “Four Russians” is offering the new service for their clients. Unlike other agencies that only suggest one-way or roundtrip for air...

2017-09-03 15:39:25

阅读数 489

评论数 0

原创 HDU-5792 World is Exploding(思维、树状数组+离散化)

Given a sequence A with length n,count how many quadruple (a,b,c,d) satisfies: a≠b≠c≠d,1≤a<b≤n,1≤c<d≤n,Aa<Ab,Ac>Ada≠b≠c≠d,1≤a<b≤n,1≤c&...

2017-09-02 17:22:06

阅读数 172

评论数 0

原创 HDU-6166 Senior Pan - 2017 Multi-University Training Contest - Team 9(最短路+二进制乱搞)

Senior Pan fails in his discrete math exam again. So he asks Master ZKC to give him graph theory problems everyday. The task is simple : ZKC will gi...

2017-09-01 16:48:11

阅读数 240

评论数 0

取消 删除