dp
文章平均质量分 91
dp
_sky123_
这个作者很懒,什么都没留下…
展开
-
Deltix Round, Spring 2021 D. Love-Hate
题目链接William is hosting a party for nnn of his trader friends. They started a discussion on various currencies they trade, but there’s an issue: not all of his trader friends like every currency. They like some currencies, but not others.For each William’原创 2021-08-13 16:27:50 · 102 阅读 · 0 评论 -
Codeforces Round #737 (Div. 2) C. Moamen and XOR
题目链接Moamen and Ezzat are playing a game. They create an array aaa of nnn non-negative integers where every element is less than 2k2^k2k.Moamen wins if a1 & a2 & a3 & … & an≥a1⊕a2⊕a3⊕…⊕ana_1 \,\&\, a_2 \,\&\, a_3 \,\&\, \ldots原创 2021-08-12 01:01:33 · 70 阅读 · 0 评论 -
AtCoder Beginner Contest 213 G.Connectivity 2
题目链接Problem StatementGiven is a simple undirected graph GGG with NNN vertices and MMM edges. The vertices are numbered 1,2,…,N1,2,\dots,N1,2,…,N, the edges are numbered 1,2,…,M1,2,\dots,M1,2,…,M, and Edge iii connects Vertex aia_iai and Vertex bib_ibi.原创 2021-08-11 20:07:43 · 278 阅读 · 0 评论 -
Codeforces Round #728 (Div. 2) D. Tree Array
题目链接You are given a tree consisting of nnn nodes. You generate an array from the tree by marking nodes one by one.Initially, when no nodes are marked, a node is equiprobably chosen and marked from the entire tree.After that, until all nodes are marked,原创 2021-08-06 16:45:48 · 197 阅读 · 0 评论 -
Codeforces Round #729 (Div. 2) D. Priority Queue
题目链接You are given a sequence AAA, where its elements are either in the form + x or -, where xxx is an integer.For such a sequence SSS where its elements are either in the form + x or -, define f(S)f(S)f(S) as follows:iterate through SSS's elements from原创 2021-08-06 13:58:23 · 136 阅读 · 0 评论 -
Codeforces Round #735 (Div. 2) B. Cobb
题目链接You are given nnn integers a1,a2,…,ana_1, a_2, \ldots, a_na1,a2,…,an and an integer kkk. Find the maximum value of i⋅j−k⋅(ai∣aj)i \cdot j - k \cdot (a_i | a_j)i⋅j−k⋅(ai∣aj) over all pairs (i,j)(i, j)(i,j) of integers with 1≤i<j≤n1 \le i < j原创 2021-07-30 13:51:30 · 174 阅读 · 0 评论 -
Educational Codeforces Round 111 E. Stringforces
题目链接You are given a string sss of length nnn. Each character is either one of the first kkk lowercase Latin letters or a question mark.You are asked to replace every question mark with one of the first kkk lowercase Latin letters in such a way that the f原创 2021-07-28 13:06:57 · 104 阅读 · 0 评论 -
Harbour.Space Scholarship Contest 2021-2022 H. XOR and Distance
题目链接You are given an array aaa consisting of nnn distinct elements and an integer kkk. Each element in the array is a non-negative integer not exceeding 2k−12^k-12k−1.Let’s define the XOR distance for a number xxx as the value off(x)=mini=1nminj=i+1n∣原创 2021-07-27 13:11:29 · 143 阅读 · 1 评论 -
2021牛客暑期多校训练营2 G.League of Legends
题目链接题目描述ZLOIers love playing League of Legends, but they seldom have time to play together.When summer vacation came, each of them scheduled some free time for it, which could be described as an interval [ai,bi)[a_i,b_i)[ai,bi) (minute).Now the n{n}n原创 2021-07-24 23:41:21 · 405 阅读 · 0 评论 -
2021牛客暑期多校训练营1 I.Increasing Subsequence
题目链接题目描述Alice is playing a game with his friend Bob on a permutation P of length N. Two players take turns choosing numbers while Alice going first.In each round, the player should pick an element in P that is larger than any element chosen by two playe原创 2021-07-20 22:24:26 · 180 阅读 · 0 评论 -
2020ICPC上海 E.The Journey of Geor Autumn
题目链接题目描述Once upon a time, there was a witch named Geor Autumn, who set off on a journey across the world. Along the way, she would meet all kinds of people, from a country full of ICPC competitors to a horse in love with dota—but with each meeting, Geor原创 2021-06-03 20:40:30 · 260 阅读 · 0 评论 -
2021ICPC山东省赛 J.Tuition Agent
题目链接题目描述Piggy is a selfless tuition agent. He already has nnn potential clients.For the iii-th client, Piggy must make one of two choices:Spend XiX_iXi RMB training this client as a tutor;Spend YiY_iYi RMB making the client become a student who nee原创 2021-06-02 20:48:34 · 644 阅读 · 5 评论 -
牛客练习赛79 E.小G的数学难题
题目链接题目描述小G在APIO2021中遇到了一个数学难题,可是经过小G漫⻓的思索,发现还是始终不能窥见真谛。具体描述下这个问题是这样的:有三个长度为nnn的数列{a1,a2,...,an}\left\{ a_{1}, a_{2}, . . . , a_{n} \right\}{a1,a2,...,an}, {b1,b2,...,bn}\left\{ b_{1}, b_{2}, . . . , b_{n} \right\}{b1,b2,...,bn}, {c1,c2,...,cn}\lef原创 2021-04-15 21:19:40 · 161 阅读 · 0 评论 -
2021ICPC昆明 C.Cities
题目链接题目描述Bob lives in a chaotic country with nn cities in a row, numbered from 111 to nnn. These cities are owned by different lords, and the iii-th cities currently belongs to the aia_iai-th lord. To simply problems, we assume there are nnn lords in the原创 2021-04-11 21:54:19 · 351 阅读 · 0 评论 -
2021ICPC昆明 G.Gift
题目链接题目描述EQWE is a pastry chef who has NNN friends. This year (obviously, the year 202120212021), he wants to give each friend a birthday cake made by himself.If EQWE wants to give the iii-th friend a birthday cake made by himself, he need cic_ici days原创 2021-04-07 23:59:51 · 649 阅读 · 0 评论 -
2021ICPC昆明 L.Simone and graph coloring
题目链接题目描述Simone, a student of Graph Coloring University, is interested in permutation. Now she is given a permutation of length nnn , and she finds that if she connects each inverse pair, she will get a graph. Formally, for the given permutation, if i<原创 2021-04-04 17:49:42 · 1918 阅读 · 1 评论 -
Codeforces Round #708 (Div. 2) E2. Square-free division (hard version)
题目链接This is the hard version of the problem. The only difference is that in this version 0≤k≤200 \leq k \leq 200≤k≤20.There is an array a1,a2,…,ana_1, a_2, \ldots, a_na1,a2,…,an of nnn positive integers. You should divide it into a minimal number of c原创 2021-03-30 20:29:04 · 122 阅读 · 0 评论 -
Codeforces Round #708 (Div. 2) D. Genius
题目链接Please note the non-standard memory limit.There are nnn problems numbered with integers from 111 to nnn. iii-th problem has the complexity ci=2ic_i = 2^ici=2i, tag tagitag_itagi and score sis_isi.After solving the problem iii it’s allowed to solv原创 2021-03-29 21:16:36 · 109 阅读 · 0 评论 -
Educational Codeforces Round 82 (Rated for Div. 2) E. Erase Subsequences
题目链接You are given a string sss. You can build new string ppp from sss using the following operation no more than two times:choose any subsequence si1,si2,…,siks_{i_1}, s_{i_2}, \dots, s_{i_k}si1,si2,…,sik where 1≤i1<i2<⋯<ik≤∣s∣1 \le i_1 &原创 2021-02-27 09:30:57 · 171 阅读 · 0 评论 -
Educational Codeforces Round 84 (Rated for Div. 2) F. AND Segments
题目链接You are given three integers nnn, kkk, mmm and mmm conditions (l1,r1,x1),(l2,r2,x2),…,(lm,rm,xm)(l_1, r_1, x_1), (l_2, r_2, x_2), \dots, (l_m, r_m, x_m)(l1,r1,x1),(l2,r2,x2),…,(lm,rm,xm).Calculate the number of distinct arrays aaa, consistin原创 2021-02-25 20:55:15 · 133 阅读 · 0 评论 -
Educational Codeforces Round 87 (Rated for Div. 2) F. Summoning Minions
题目链接Polycarp plays a computer game. In this game, the players summon armies of magical minions, which then fight each other.Polycarp can summon nnn different minions. The initial power level of the iii-th minion is aia_iai, and when it is summoned, all原创 2021-02-22 23:33:05 · 155 阅读 · 1 评论 -
Educational Codeforces Round 89 (Rated for Div. 2) G. Construct the String
题目链接Let’s denote the function f(s)f(s)f(s) that takes a string sss consisting of lowercase Latin letters and dots, and returns a string consisting of lowercase Latin letters as follows:let rrr be an empty string;process the characters of sss from left原创 2021-02-21 21:40:11 · 175 阅读 · 0 评论 -
Educational Codeforces Round 89 (Rated for Div. 2) F. Jog Around The Graph
题目链接You are given a simple weighted connected undirected graph, consisting of nnn vertices and mmm edges.A path in the graph of length kkk is a sequence of k+1k+1k+1 vertices v1,v2,…,vk+1v_1, v_2, \dots, v_{k+1}v1,v2,…,vk+1 such that for each iii (1≤i原创 2021-02-21 16:56:23 · 158 阅读 · 0 评论 -
Educational Codeforces Round 97 (Rated for Div. 2) F. Emotional Fishermen
题目链接nnn fishermen have just returned from a fishing vacation. The iii-th fisherman has caught a fish of weight aia_iai.Fishermen are going to show off the fish they caught to each other. To do so, they firstly choose an order in which they show their fi原创 2021-02-18 00:17:05 · 153 阅读 · 0 评论 -
Educational Codeforces Round 99 (Rated for Div. 2) G. Forbidden Value
题目链接Polycarp is editing a complicated computer program. First, variable xxx is declared and assigned to 000. Then there are instructions of two types:set yyy vvv — assign xxx a value yyy or spend vvv burles to remove that instruction (thus, not reassign原创 2021-02-12 15:54:27 · 337 阅读 · 0 评论 -
Educational Codeforces Round 99 (Rated for Div. 2) F. String and Operations
题目链接You are given a string sss consisting of nnn characters. These characters are among the first kkk lowercase letters of the Latin alphabet. You have to perform nnn operations with the string.During the iii-th operation, you take the character that ini原创 2021-02-11 17:01:00 · 177 阅读 · 0 评论 -
Educational Codeforces Round 19 F. Mice and Holes
题目链接One day Masha came home and noticed nnn mice in the corridor of her flat. Of course, she shouted loudly, so scared mice started to run to the holes in the corridor.The corridor can be represeted as a numeric axis with nnn mice and mmm holes on it. it原创 2021-02-10 08:26:56 · 167 阅读 · 0 评论 -
P3195 [HNOI2008]玩具装箱
题目链接题目描述P 教授要去看奥运,但是他舍不下他的玩具,于是他决定把所有的玩具运到北京。他使用自己的压缩器进行压缩,其可以将任意物品变成一堆,再放到一种特殊的一维容器中。P 教授有编号为 1⋯n1 \cdots n1⋯n 的 nnn 件玩具,第 iii 件玩具经过压缩后的一维长度为 CiC_iCi。为了方便整理,P教授要求:在一个一维容器中的玩具编号是连续的。同时如果一个一维容器中有多个玩具,那么两件玩具之间要加入一个单位长度的填充物。形式地说,如果将第 iii 件玩具到第 jjj原创 2021-02-07 18:49:27 · 290 阅读 · 0 评论 -
P2569 [SCOI2010]股票交易
题目链接题目描述最近 lxhgww\text{lxhgww}lxhgww 又迷上了投资股票,通过一段时间的观察和学习,他总结出了股票行情的一些规律。通过一段时间的观察,lxhgww\text{lxhgww}lxhgww 预测到了未来 TTT 天内某只股票的走势,第 iii 天的股票买入价为每股 APiAP_iAPi,第 iii 天的股票卖出价为每股 BPiBP_iBPi(数据保证对于每个 iii,都有 APi≥BPiAP_i \geq BP_iAPi≥BPi),但是每天不能无限制地交易,于是股原创 2021-02-07 10:33:08 · 233 阅读 · 0 评论 -
P2254 [NOI2005] 瑰丽华尔兹
题目链接题目描述不妨认为舞厅是一个 NNN 行 MMM 列的矩阵,矩阵中的某些方格上堆放了一些家具,其他的则是空地。钢琴可以在空地上滑动,但不能撞上家具或滑出舞厅,否则会损坏钢琴和家具,引来难缠的船长。每个时刻,钢琴都会随着船体倾斜的方向向相邻的方格滑动一格,相邻的方格可以是向东、向西、向南或向北的。而艾米丽可以选择施魔法或不施魔法:如果不施魔法,则钢琴会滑动;如果施魔法,则钢琴会原地不动。艾米丽是个天使,她知道每段时间的船体的倾斜情况。她想使钢琴在舞厅里滑行的路程尽量长,这样 1900 会非常高兴,原创 2021-02-06 23:08:08 · 164 阅读 · 1 评论 -
Codeforces Round #219 (Div. 1) C. Watching Fireworks is Fun
题目链接A festival will be held in a town’s main street. There are nnn sections in the main street. The sections are numbered 111 through nnn from left to right. The distance between each adjacent sections is 111.In the festival mmm fireworks will be launche原创 2021-02-06 17:20:52 · 142 阅读 · 0 评论 -
Codeforces Round #699 (Div. 2) E. Sorting Books
题目链接One day you wanted to read something, so you went to your bookshelf to grab some book. But when you saw how messy the bookshelf was you decided to clean it up first.There are nnn books standing in a row on the shelf, the iii-th book has color aia_ia原创 2021-02-06 09:40:12 · 242 阅读 · 0 评论 -
Codeforces Round #695 (Div. 2) D. Sum of Paths
题目链接There are nnn cells, numbered 1,2,…,n1,2,\dots, n1,2,…,n from left to right. You have to place a robot at any cell initially. The robot must make exactly kkk moves.In one move, the robot must move one cell to the left or right, provided that it doesn原创 2021-01-30 20:56:26 · 82 阅读 · 0 评论 -
2020 Multi-University Training Contest 10 Permutation Counting
Problem DescriptionFor a given permutation a1,a2,…,ana_1,a_2,\dots,a_na1,a2,…,an of length nnn, we defined the neighbor sequence bbb of aaa, the length of which is n−1n−1n−1, as following:bi={0 ai<ai+11 ai>ai+1b_i=\left\{\begin{matrix原创 2020-09-17 23:52:10 · 154 阅读 · 0 评论 -
Codeforces Round #669 (Div. 2)D. Discrete Centrifugal Jumps
题目链接There are nnn beautiful skyscrapers in New York, the height of the iii-th one is hih_ihi. Today some villains have set on fire first n−1n−1n−1 of them, and now the only safety building is nnn-th skyscraper.Let’s call a jump from iii-th skyscraper to原创 2020-09-09 11:30:54 · 161 阅读 · 0 评论 -
2020 Multi-University Training Contest 2 String Distance
题目链接Problem DescriptionFor two strings SSS and TTT, you can do the following operation for arbitrary number of times: Select a string SSS or TTT, insert or delete a character at any position. The distance between two strings SSS and TTT is defined as the原创 2020-08-28 15:54:20 · 139 阅读 · 0 评论 -
Rarity and New Dress
Carousel Boutique is busy again! Rarity has decided to visit the pony ball and she surely needs a new dress, because going out in the same dress several times is a sign of bad manners. First of all, she needs a dress pattern, which she is going to cut out原创 2020-08-11 15:42:12 · 202 阅读 · 1 评论 -
Social Distancing
链接:https://ac.nowcoder.com/acm/contest/5672/A来源:牛客网题目描述Nowadays, the Kingdom of Dreamgrid is suffering from a national pandemic. Fortunately, president Baobao is working effectively with the Center for Disease Control (CDC) and they are trying their bes原创 2020-08-07 09:42:13 · 656 阅读 · 0 评论 -
Portal
链接:https://ac.nowcoder.com/acm/contest/5670/A来源:牛客网题目描述You are now in a big factory. The factory could be recognized as a graph with nnn vertices and mmm edges. Every edge has its length. You have kkk missions to do. The iii-th mission is going to verte原创 2020-08-03 09:42:02 · 201 阅读 · 0 评论