小坏蛋_千千

I was caught in a heavy rain!

codevs 2498 IncDec Sequence (差分数组)

Description 给定一个长度为 n 的数列 {a1,a2…an} ,每次可以选择一个区间 [l,r] ,使这个区间内的数都加一或者都减一。 问至少需要多少次操作才能使数列中的所有数都一样,并求出在保证最少次数的前提下,最终得到的数列有多少种。 &nbs...

2018-04-24 16:18:58

阅读数:59

评论数:0

蓝桥杯 国王的烦恼 (并查集)

问题描述 C国由n个小岛组成,为了方便小岛之间联络,C国在小岛间建立了m座大桥,每座大桥连接两座小岛。两个小岛间可能存在多座桥连接。然而,由于海水冲刷,有一些大桥面临着不能使用的危险。 如果两个小岛间的所有大桥都不能使用,则这两座小岛就不能直接到达了。然而,只要这两座小岛的居民能...

2018-03-22 11:24:22

阅读数:59

评论数:0

FZU 2219 StarCraft (哈夫曼树)

Description ZB loves playing StarCraft and he likes Zerg most! One day, when ZB was playing SC2, he came up with an idea: He wants to c...

2018-01-27 22:20:48

阅读数:85

评论数:0

Codeforces 890 D. Boxes And Balls (哈夫曼)

Description Ivan has n different boxes. The first of them contains some balls of n different colors. Ivan wants to play a strange game. He wan...

2017-11-17 20:06:30

阅读数:182

评论数:0

Codeforces 861 D. Polycarp's phone book (trie)

Description There are n phone numbers in Polycarp’s contacts on his phone. Each number is a 9-digit integer, starting with a digit different from 0...

2017-10-03 21:20:31

阅读数:163

评论数:0

Codeforces 852 G. Bathroom terminal(trie)

Description Smith wakes up at the side of a dirty, disused bathroom, his ankle chained to pipes. Next to him is tape-player with a hand-written mes...

2017-09-05 17:35:04

阅读数:223

评论数:0

Codeforces 842 D. Vitya and Strange Lesson (trie)

Description Today at the lesson Vitya learned a very interesting function — mex. Mex of a sequence of numbers is the minimum non-negative number th...

2017-08-30 16:17:51

阅读数:649

评论数:0

POJ 2104 K-th Number (划分树 / 主席树)

Description You are working for Macrohard company in data structures department. After failing your previous task about key insertion you were aske...

2017-08-23 18:24:14

阅读数:195

评论数:0

POJ 3321 Apple Tree (树状数组)

Description There is an apple tree outside of kaka’s house. Every autumn, a lot of apples will grow in the tree. Kaka likes apple very much, so he ...

2017-08-19 19:43:52

阅读数:158

评论数:0

HDU 6059 Kanade's trio (字典树)

Description Give you an array A[1..n]A[1..n] ,you need to calculate how many tuples (i,j,k)(i,j,k) satisfy that (i<j<k)(i<j<k) and ((A[...

2017-08-12 19:25:45

阅读数:247

评论数:0

HDU 6041 I Curse Myself (仙人掌图)

Description There is a connected undirected graph with weights on its edges. It is guaranteed that each edge appears in at most one simple cycle. ...

2017-07-31 21:48:12

阅读数:248

评论数:0

codevs 2370 小机房的树 (LCA)

Description 小机房有棵焕狗种的树,树上有N个节点,节点标号为0到N-1,有两只虫子名叫飘狗和大吉狗,分居在两个不同的节点上。有一天,他们想爬到一个节点上去搞基,但是作为两只虫子,他们不想花费太多精力。已知从某个节点爬到其父亲节点要花费 c 的能量(从父亲节点爬到此节点也相同),他们...

2017-07-27 09:40:03

阅读数:160

评论数:0

codevs 1036 商务旅行 (LCA)

Description 某首都城市的商人要经常到各城镇去做生意,他们按自己的路线去做,目的是为了更好的节约时间。 假设有N个城镇,首都编号为1,商人从首都出发,其他各城镇之间都有道路连接,任意两个城镇之间如果有直连道路,在他们之间行驶需要花费单位时间。该国公路网络发达,从首都出发能到...

2017-07-25 10:23:42

阅读数:198

评论数:0

POJ 1470 Closest Common Ancestors (LCA)

Description Write a program that takes as input a rooted tree and a list of pairs of vertices. For each pair (u,v) the program determines the close...

2017-07-24 16:19:38

阅读数:140

评论数:0

POJ 1330 Nearest Common Ancestors (LCA)

Description A rooted tree is a well-known data structure in computer science and engineering. An example is shown below: In the figure, ...

2017-07-24 15:29:36

阅读数:197

评论数:0

『数据结构』RMQ 问题

RMQ (Range Minimum/Maximum Query),即区间最值问题 对于长度为 n 的数列,回复若干次查询,返回某个区间的最大(小)值

2017-07-13 21:56:13

阅读数:263

评论数:0

UPC 1017 Easy Tree Query (二叉搜索树)

题目描述 You are given a binary search tree with depth k, whose nodes are valued from 1 to (2k − 1) and then Q queries. For each query, you are gi...

2017-05-05 10:54:16

阅读数:379

评论数:0

POJ 2442 Sequence (堆)

Description Given m sequences, each contains n non-negative integer. Now we may select one number from each sequence to form a sequence with m inte...

2017-02-28 13:24:42

阅读数:264

评论数:0

POJ 3253 Fence Repair (哈夫曼)

Description Farmer John wants to repair a small length of the fence around the pasture. He measures the fence and finds that he needs N (1 ≤ N ≤ 20...

2017-02-21 22:16:40

阅读数:227

评论数:0

POJ 1611 The Suspects (并查集)

Description Severe acute respiratory syndrome (SARS), an atypical pneumonia of unknown aetiology, was recognized as a global threat in mid-March 20...

2017-02-21 21:25:21

阅读数:229

评论数:0

提示
确定要删除当前文章?
取消 删除
关闭
关闭