自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

天翼之城的博客

菜鸟的记录

  • 博客(46)
  • 收藏
  • 关注

原创 COCI Parametriziran —— 状压+dfs求相似字符串个数

DescriptionInputOutputSample Input3 3??bc??c?c4 6ab??c???kll?a?k??c?bcd??5 2??b?c??gcgSample Output238Hint题意:给你n个长度相同的字符串,这些字符串中含有小写字母和’?’,’?'可以替换成任意字符,如果两个替换之后的字符串可以相等,那么...

2019-03-31 21:08:00 259

原创 Codeforces Contest 1099 problem F Cookies —— 权值线段树+树形DP

Mitya and Vasya are playing an interesting game. They have a rooted tree with n vertices, and the vertices are indexed from 1 to n. The root has index 1. Every other vertex i≥2 has its parent pi, and ...

2019-03-29 21:49:30 216

原创 Codeforces Contest 1080 E Sonya and Matrix Beauty —— 马拉车求回文矩形个数

Sonya had a birthday recently. She was presented with the matrix of size n×m and consist of lowercase Latin letters. We assume that the rows are numbered by integers from 1 to n from bottom to top, an...

2019-03-29 16:31:22 289

原创 Codeforces Contest 1083 problem E The Fair Nut and Rectangles —— 斜率优化DP

The Fair Nut got stacked in planar world. He should solve this task to get out.You are given n rectangles with vertexes in (0,0), (xi,0), (xi,yi), (0,yi). For each rectangle, you are also given a num...

2019-03-29 11:43:46 399

原创 Codeforces Contest 1089 problem K King Kog's Reception —— 线段树求当等队列所需要的时间

King Kog got annoyed of the usual laxity of his knights — they can break into his hall without prior notice! Thus, the King decided to build a reception with a queue where each knight chooses in advan...

2019-03-28 12:24:06 481

原创 Codeforces Contest 1097 problem F Alex and a TV Show —— 莫比乌斯反演+bitset

Alex decided to try his luck in TV shows. He once went to the quiz named “What’s That Word?!”. After perfectly answering the questions “How is a pseudonym commonly referred to in the Internet?” (“Um… ...

2019-03-26 19:07:34 490

原创 Codeforces Contest 1101 problem G (Zero XOR Subset)-less —— 线性基

You are given an array a1,a2,…,an of integer numbers.Your task is to divide the array into the maximum number of segments in such a way that:each element is contained in exactly one segment;each se...

2019-03-24 19:59:40 182

原创 Codeforces Problemset problem 1120 A Diana and Liana —— 尺取

At the first holiday in spring, the town Shortriver traditionally conducts a flower festival. Townsfolk wear traditional wreaths during these festivals. Each wreath contains exactly k flowers.The wor...

2019-03-23 20:47:09 319

原创 Deblo —— 树形DP+爆栈的解决方案

DescriptionInputOutputSample Input31 2 31 22 352 3 4 2 11 21 33 43 565 4 1 3 3 33 13 54 34 22 6Sample Output106485Hint题意:给你一棵树和每个点的权值,一条边的权值就是边上所有点的权值的异或,让你求出所有点的权值和+所有边...

2019-03-23 19:05:02 305

原创 Codeforces Contest 1120 problem C Compress String —— 字符串hash+dp 结构体unique的方法

Suppose you are given a string s of length n consisting of lowercase English letters. You need to compress it using the smallest possible number of coins.To compress the string, you have to represent...

2019-03-22 15:57:47 335

原创 Codeforces Contest 1129 problem C Morse Code ——字典树+dp

In Morse code, an letter of English alphabet is represented as a string of some length from 1 to 4. Moreover, each Morse code representation of an English letter contains only dots and dashes. In this...

2019-03-21 15:04:33 181

原创 Codeforces Problemset problem 1129 B Wrong Answer —— 构造数组

Consider the following problem: given an array a containing n integers (indexed from 0 to n−1), find max0≤l≤r≤n−1∑l≤i≤r(r−l+1)⋅ai. In this problem, 1≤n≤2000 and |ai|≤106.In an attempt to solve the pr...

2019-03-20 20:35:32 335

原创 Codeforces Problemset problem 629 C Famil Door and Brackets —— dp构造完美括号匹配

As Famil Door’s birthday is coming, some of his friends (like Gabi) decided to buy a present for him. His friends are going to buy a string consisted of round brackets since Famil Door loves string of...

2019-03-20 16:44:26 340

原创 Codeforces Problemset problem 633 D Fibonacci-ish —— 构造类斐波那契数列

Yash has recently learnt about the Fibonacci sequence and is very excited about it. He calls a sequence Fibonacci-ish ifthe sequence consists of at least two elementsf0 and f1 are arbitraryfn + 2 =...

2019-03-20 16:38:07 206

原创 Codeforces Contest 1117 problem D Magic Gems —— 矩阵快速幂

Reziba has many magic gems. Each magic gem can be split into M normal gems. The amount of space each magic (and normal) gem takes is 1 unit. A normal gem cannot be split.Reziba wants to choose a set ...

2019-03-19 13:33:12 1792

原创 Codeforces Contest 82 problem D Two out of Three —— 记忆化搜索

Vasya has recently developed a new algorithm to optimize the reception of customer flow and he considered the following problem.Let the queue to the cashier contain n people, at that each of them is ...

2019-03-18 21:45:12 282

原创 Codeforces Contest 1117 problem C Magic Ship——二分

You a captain of a ship. Initially you are standing in a point (x1,y1) (obviously, all positions in the sea can be described by cartesian plane) and you want to travel to a point (x2,y2).You know the...

2019-03-18 16:01:21 296

原创 Codeforces Gym 101982 F Rectangles —— 线段树+扫描线求面被矩形个数为奇数个的面积

题意:给你n个矩形,问你所有多少1*1的格子被奇数个矩形覆盖。题解:用线段树做一下区间更新即可。这里是奇数个矩形, 可以用异或来处理 数组。用 记录一个区间上的有效 方向的 长度,被异或的话就根据原来的长度减一下就行。需要注意的是,线段树为点值,而这里 实际上只有 个值。只 需要将原来的 和L<=mid改成 和 L<mid即可。(相当于 的位置有一条线)#include&...

2019-03-18 15:07:19 610

原创 Count The Bits —— 数位DP

Given an integer k and a number of bits b (1 ≤ b ≤ 128), calculate the total number of 1 bits in the binary representations of multiples of k between 0 and 2b −1 (inclusive), modulo 1,000,000,009.Inp...

2019-03-17 19:22:22 712

原创 Contest Setting —— dp求n种数取m个的情况数

A group of contest writers have written n problems and want to use k of them in an upcoming contest. Each problem has a difficulty level. A contest is valid if all of its k problems have different difficul...

2019-03-17 19:09:55 253

原创 Coprime Integers—— 莫比乌斯反演

Given intervals [a,b] and [c,d], count the number of pairs of coprime integers (x,y) such that a ≤ x ≤ b and c ≤ y ≤ d. Two numbers are coprime if their greatest common divisor is 1. A divisor of a nu...

2019-03-17 18:51:56 447 1

原创 “字节跳动-文远知行杯”广东工业大学第十四届程序设计竞赛 1,2,3,4,5,7,8,9,10

1001:hzy 和zsl 的生存挑战Problem Descriptionzsl 和hzy 来到了臭臭城堡,打算挑战臭臭城堡的大魔王hyz,大魔王hyz设置了这样的一个挑战:zsl 和hzy两个人各自来到一间密室,期间两人无法以任何形式交流大魔王hyz会随机在两个人的脑海里各发送一个数字,0或者是1zsl 和 hzy 需要猜对这俩个数字才算通关,但是大魔王hyz觉得人生不能过于无敌...

2019-03-16 20:37:19 2573

原创 Codeforces Contest 1113 problem C Sasha and a Bit of Relax —— 两个相邻等长异或和相同的区间个数

Sasha likes programming. Once, during a very long contest, Sasha decided that he was a bit tired and needed to relax. So he did. But since Sasha isn’t an ordinary guy, he prefers to relax unusually. D...

2019-03-16 19:03:49 230

原创 [USACO18DEC]Fine Dining —— 最短路

题目描述漫长的一天结束了,饥困交加的奶牛们准备返回牛棚。农场由 NN 片牧场组成(2\le N\le 5\times 10^42≤N≤5×104),方便起见编号为 1\dots N1…N。所有奶牛都要前往位于牧场 NN 的牛棚。其他 N−1N−1N−1 片牧场中每片有一头奶牛。奶牛们可以通过 MM 条无向的小路在牧场之间移动(1\le M\le 10^51≤M≤105)。第i条小路连接...

2019-03-14 19:45:08 528

原创 Multiplayer Moo —— 搜索任意两个数为一组相邻的最大出现次数

DescriptionInputOutput输出的第一行描述任何单头奶牛占有的最大领域大小,第二行描述任何两头奶牛的队伍占有的最大领域的大小。Sample Input42 3 9 34 9 9 19 9 1 72 1 1 9Sample Output510Hint题意:给你一个矩阵,让你输出只有一头奶牛所占领的相邻的最大面积和两头奶牛所占领的最大相邻的面积。题...

2019-03-14 12:03:35 241

原创 P4374 [USACO18OPEN]Disruption —— 树剖 + lca 存边变为存子节点

题目描述Farmer John自豪于他所经营的交通发达的的农场。这个农场是由NN块牧场(2 \leq N \leq 50,0002≤N≤50,000)组成的,N-1N−1条双向道路将它们连接起来,每一条道路的都为一单位长度。Farmer John注意到,从任何一块牧场到另一块牧场,都能通过一组合适的道路到达。尽管FJ的农场现在是连通的,他担心如果有一条道路被阻断会发生什么,因为这事实上会将他的...

2019-03-12 10:04:16 186

原创 Teamwork —— dp求让每个区间长度*区间最大值的和最大

DescriptionInputOutputPlease print the highest possible sum of skill levels FJ can achieve by grouping appropriate consecutive sets of cows into teams.Sample Input7 3115792510Sample Out...

2019-03-09 21:45:04 722

原创 Convention —— 二分

DescriptionInputOutputPlease write one line containing the optimal minimum maximum waiting time for any one arriving cow.Sample Input6 3 21 1 10 14 4 3Sample Output4Hint题意:有n个人要上车,你有m辆车,...

2019-03-09 21:38:43 247

原创 Cowpatibility —— bitset找与某个数组有任何一个元素相交的所有数组

DescriptionInputOutputPlease output the number of pairs of cows that are not compatible.Sample Input41 2 3 4 51 2 3 10 810 9 8 7 650 60 70 80 90Sample Output4Hint题意:给你n个含有5个数字的数组,两个数组有...

2019-03-09 21:34:41 173

原创 Back and Forth —— set的删除操作

DescriptionInputOutputSample Input1 1 1 1 1 1 1 1 1 25 5 5 5 5 5 5 5 5 5Sample Output5Hint题意:一个人有两个存牛奶的仓库,每个仓库里有10个桶,一开始每个仓库都有1000的牛奶,星期二他随便从第一个仓库里拿了一个桶装满牛奶倒到第二个仓库,星期三从第二个仓库随便拿一个桶(有可能是星期...

2019-03-09 21:27:55 296

原创 Codeforces Contest 1114 problem C Trailing Loves (or L'oeufs?) —— 将1进制下的阶乘变成k进制,最后有几个0

Aki is fond of numbers, especially those with trailing zeros. For example, the number 9200 has two trailing zeros. Aki thinks the more trailing zero digits a number has, the prettier it is.However, A...

2019-03-09 21:07:15 230

原创 Codeforces Contest 1114 problem D Flood Fill —— 区间dp

You are given a line of n colored squares in a row, numbered from 1 to n from left to right. The i-th square initially has the color ci.Let’s say, that two squares i and j belong to the same connecte...

2019-03-09 20:59:14 180

原创 Codeforces Contest 1110 problem F Nearest Leaf —— 读题+dfs序+区间更新线段树

Let’s define the Eulerian traversal of a tree (a connected undirected graph without cycles) as follows: consider a depth-first search algorithm which traverses vertices of the tree and enumerates them...

2019-03-08 12:56:42 166

原创 Codeforces Contest 1110 problem E Magic Stones —— 更改算式

Grigory has n magic stones, conveniently numbered from 1 to n. The charge of the i-th stone is equal to ci.Sometimes Grigory gets bored and selects some inner stone (that is, some stone with index i,...

2019-03-07 20:05:55 330

原创 Codeforces Contest 1110 problem D Jongmah——三种状态的dp

You are playing a game of Jongmah. You don’t need to know the rules to solve this problem. You have n tiles in your hand. Each tile has an integer between 1 and m written on it.To win the game, you w...

2019-03-07 13:22:13 167

原创 Codeforces Contest 1110 problem C Meaningless Operations——找区间内两个数的与和异或的最大gcd

Can the greatest common divisor and bitwise operations have anything in common? It is time to answer this question.Suppose you are given a positive integer a. You want to choose some integer b from 1...

2019-03-06 16:04:57 295

原创 Codeforces Contest 1110 problem B Tape —— 由加变为减

You have a long stick, consisting of m segments enumerated from 1 to m. Each segment is 1 centimeter long. Sadly, some segments are broken and need to be repaired.You have an infinitely long repair t...

2019-03-06 15:56:23 172

原创 Codeforces Contest 1111 problem D Destroy the Colony —— DP+组合数学,求将一个区间分成两个,不改变两个区间中的数的情况数

There is a colony of villains with several holes aligned in a row, where each hole contains exactly one villain.Each colony arrangement can be expressed as a string of even length, where the i-th cha...

2019-03-05 20:30:33 148

原创 Codeforces Contest 1111 problem C Creative Snap ——二分找两种限制下的最小情况

Thanos wants to destroy the avengers base, but he needs to destroy the avengers along with their base.Let we represent their base with an array, where each position can be occupied by many avengers, ...

2019-03-04 20:44:49 349

原创 Cow Poetry——读题+dp

DescriptionInputOutputSample Input3 3 103 14 13 2ABASample Output960Hint在这个例子中,Bessie认识三个单词。前两个单词押韵,长度分别为三个音节和四个音节,最后一个单词长度为三个音节,不与其他单词押韵。她想要写一首三行的诗,每行包含十个音节,并且第一行和最后一行押韵。共有960首这样的诗。以...

2019-03-04 20:02:57 290

空空如也

空空如也

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

TA关注的人

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