自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(23)
  • 收藏
  • 关注

原创 51nod 双重祖先(启发式合并)

双重祖先Problem Description给定两棵有根树,两棵树均有​n个节点,且根均为​1号点。问有多少对​(u,v)满足:在给定的两棵树中u均为v的祖先。Input本题中每个测试点仅包含一组测试数据第一行一个正整数n,表示树的规模接下来的n-1行,每行两个整数x, y,表示在第一棵有根树中x点与y点之间有一条连边。再接下来的n-1行,每行两个整数x, y,表示在第二棵有根树...

2020-03-30 15:15:19 335

原创 51nod_1225 余数之和(分块)

余数之和Problem DescriptionF(n) = (n % 1) + (n % 2) + (n % 3) + … (n % n)。其中%表示Mod,也就是余数。例如F(6) = 6 % 1 + 6 % 2 + 6 % 3 + 6 % 4 + 6 % 5 + 6 % 6 = 0 + 0 + 0 + 2 + 1 + 0 = 3。给出n,计算F(n), 由于结果很大,输出Mod 100...

2020-03-29 12:45:30 217

原创 ZOJ_3964 Yet Another Game of Stones(博弈论)

Yet Another Game of StonesTime Limit: 1000 msMemory Limit: 65536 KBProblem DescriptionAlice and Bob are playing yet another game of stones. The rules of this game are as follow:The game starts w...

2020-03-26 20:45:53 282

原创 CodeForces_1234E Special Permutations(数论)

Special Permutationstime limit per test:2 secondsmemory limit per test:256 megabytesProblem DescriptionLet’s define pi(n)p_i(n)pi​(n) as the following permutation: [i,1,2,…,i−1,i+1,…,n][i,1,2,…,i−...

2020-03-25 19:25:47 253

原创 51nod_2861 满汉全席(2-SAT)

满汉全席Problem Description满汉全席是中国最丰盛的宴客菜肴,有许多种不同的材料透过满族或是汉族的料理方式,呈现在数量繁多的菜色之中。由于菜色众多而繁杂,只有极少数博学多闻技艺高超的厨师能够做出满汉全席,而能够烹饪出经过专家认证的满汉全席,也是中国厨师最大的荣誉之一。世界满汉全席协会是由能够料理满汉全席的专家厨师们所组成,而他们之间还细分为许多不同等级的厨师。为了招收新进的厨...

2020-03-25 11:41:00 184

原创 51nod_1809 黑白图(DFS+树状数组)

黑白图Problem Description黑白图是一个由n个点和n-1条边组成的无向连通图。在图中最多只有一个节点的度会超过2,其余点的度要么为1,要么为2。一个节点的度指的是与该节点有边相连的节点的个数。图中的边是有颜色的,要么白色,要么黑色。一开始所有的边都是黑色。对黑白图我们可以进行以下三种操作:1)把第i条边变成黑色。第i条边是指在图中编号为i的边。(这里保证第i条边在变色前是白...

2020-03-24 18:00:13 216

原创 51nod_2607 摧毁数组(并查集)

摧毁数组Problem Description有一个由n个非负整数组成的数列 a1,a2,a3…an。现在将要一个一个摧毁这个数列中的数。同时,有一个由 1 到 n 组成的序列来告诉你每个数被摧毁的时间顺序。每当一个元素被摧毁时,你需要找到这个当前数列中的未被摧毁的数组成的和最大的连续子序列,另外,如果当前剩余的序列是空的的话,最大和就是0。第一个样例:1.第三个数被删除了,现在的数列是...

2020-03-24 17:45:47 1287

原创 SGU_106 The equation(扩展欧几里得)

Ice-cream TycoonTime limit per test: 0.5 second(s)Memory limit: 65536 kilobytesProblem DescriptionInputOutputSample InputSample Output题意题解:

2020-03-23 11:19:51 161

原创 POJ_2728 Desert King(最优比率生成树)

Desert KingTime Limit: 3000MS Memory Limit: 65536KProblem DescriptionDavid the Great has just become the king of a desert country. To win the respect of his people, he decided to build channels al...

2020-03-21 20:19:10 163

原创 CodeForces_1326D Prefix-Suffix Palindrome(Manachar)

Prefix-Suffix Palindrometime limit per test:2 secondsmemory limit per test:512 megabytesProblem DescriptionYou are given a string sss, consisting of lowercase English letters. Find the longest str...

2020-03-20 10:59:59 253

原创 ZOJ_3108 Last Digit(组合数学)

Last DigitTime Limit: 2000 msMemory Limit: 32768 KBProblem DescriptionThe number of permutation without repetition that has a string S is so big, but in this problem you just need to print the las...

2020-03-18 21:26:29 146

原创 ZOJ_4127 Grid with Arrows(欧拉路径 || 动态规划)

Grid with ArrowsTime Limit: 1000 msMemory Limit: 65536 KBProblem DescriptionBaoBao has just found a grid with nnn rows and mmm columns in his left pocket, where the cell in the jjj-th column of th...

2020-03-17 16:40:18 360

原创 CodeForces_1324F Maximum White Subtree(动态规划)

Maximum White Subtreetime limit per test:2 secondsmemory limit per test:512 megabytesProblem DescriptionYou are given a tree consisting of nnn vertices. A tree is a connected undirected graph with...

2020-03-16 22:21:06 146

原创 ZOJ_4114 Flipping Game(动态规划)

Flipping GameTime Limit: 1000 msMemory Limit: 65536 KBProblem DescriptionLittle Sub loves playing the game Flip Me Please. In the game, nnn lights, numbered from 1 to nnn, are connected separately...

2020-03-14 10:19:06 257

原创 ZOJ_4010 Neighboring Characters(哈希)

Neighboring CharactersTime Limit: 4000 msMemory Limit: 65536 KBProblem DescriptionGiven a string s of length n, let’s define the neighbors of the i-th character (1≤i≤n1\le i\le n1≤i≤n) as follows...

2020-03-12 09:06:15 144

原创 ZOJ_4006 Travel along the Line(组合数学)

Travel along the LineTime Limit: 1000 msMemory Limit: 65536 KBProblem DescriptionBaoBao is traveling along a line with infinite length.At the beginning of his trip, he is standing at position 0. ...

2020-03-10 22:05:27 132

原创 51nod_1275 连续子段的差异(单调队列)

连续子段的差异Problem Description给出一个包括N个元素的整数数组A,包括A本身在内,共有 (N+1)*N / 2个非空子段。例如:1 3 2的子段为{1} {3} {2} {1 3} {3 2} {1 3 2}。在这些子段中,如果最大值同最小值的差异不超过K,则认为这是一个合格的子段。给出数组A和K,求有多少符合条件的子段。例如:3 5 7 6 3,K = 2,符合条件的子段...

2020-03-09 14:06:29 233

原创 POJ_3419 Difference Is Beautiful(ST表)

Difference Is BeautifulTime Limit: 5000MS Memory Limit: 65536KProblem DescriptionMr. Flower’s business is growing much faster than originally planned. He has now become the CEO of a world-famous b...

2020-03-07 13:41:21 256

原创 ZOJ_2671 Cryptography(数据结构)

CryptographyTime Limit: 5000 msMemory Limit: 32768 KBProblem DescriptionYoung cryptoanalyst Georgie is planning to break the new cipher invented by his friend Andie. To do this, he must make some ...

2020-03-06 21:21:52 151

原创 ZOJ_3162 To Go or Not to Go(数论)

To Go or Not to GoTime Limit: 1000 msMemory Limit: 32768 KBProblem DescriptionWyest and Winsty are two lazy kids who’d rather eat some snacks in the dorm than go to the dining hall. Wyest, however...

2020-03-04 22:35:20 239

原创 ZOJ_3265 Strange Game(匈牙利算法)

Strange GameTime Limit: 3000 msMemory Limit: 32768 KBProblem DescriptionThere is a strange game played on a special machine. The game has m prizes labeled from 0 to m-1. First, you are given n tic...

2020-03-03 21:17:21 198

原创 CodeForces_1320C World of Darkraft: Battle for Azathoth(线段树)

World of Darkraft: Battle for Azathothtime limit per test:2 secondsmemory limit per test:512 megabytesProblem DescriptionRoma is playing a new expansion for his favorite game World of Darkraft. He...

2020-03-02 18:08:43 407

原创 SGU_311 Ice-cream Tycoon(线段树)

Ice-cream TycoonTime limit per test: 0.5 second(s)Memory limit: 65536 kilobytesProblem DescriptionYou’ve recently started an ice-cream business in a local school. During a day you have many suppli...

2020-03-01 19:43:06 186

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

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