
【codeforces 有趣的题】
Kuguotao
这个作者很懒,什么都没留下…
展开
-
D.C. Connect(搜索)(cf)
D.C. Connect(搜索)Alice lives on a flat planet that can be modeled as a square grid of sizen×nn×n, with rows and columns enumerated from11tonn. We represent the cell at the intersection of rowrr...原创 2019-03-14 10:14:09 · 413 阅读 · 0 评论 -
D. Restore Permutation(树状数组+二分)
D. Restore Permutation题意:第一行给你一个数n,第二行输入n个数,第 i 个数表示其前面的所有比其小的数的和,让你还原这个原数列(该原数列数值1->n)。思路:从后往前解决。利用树状数组求出tree[i]。利用二分查找a[i],确定位置,存入s[i],最后输出。代码:#include <cstdio>#include <queue&...原创 2019-09-02 21:33:56 · 235 阅读 · 0 评论 -
C. Beautiful Lyrics (CF vector pair的使用)
ou are givennnwords, each of which consists of lowercase alphabet letters. Each wordcontains at leastone vowel. You are going to choose some of the given words and make as many beautiful lyrics as...原创 2019-07-17 14:50:54 · 276 阅读 · 2 评论 -
C2. Exam in BerSU (hard version)(CF 思维)
http://codeforces.com/contest/1185/problem/C2题意:一个序列的数字,从左往右取数字,第i的数字一定要取,问你前面最少只有几个数字没取,满足取的数字和小于m最开始那个简单的题用优先队列过了,这个会超时还是交了一发,blem/C2题意:一个序列的数字,从左往右取数字,第i的数字一定要取,问你前面最少只有几个数字没取,满足取...原创 2019-07-18 12:00:39 · 298 阅读 · 0 评论 -
C. Problem for Nazar(cf)
teacher gave him avery difficult task.Consider two infinite sets of numbers. The first set consists of odd positive numbers (1,3,5,7,…1,3,5,7,…), and the second set consists of even positive number...原创 2019-04-19 14:56:31 · 527 阅读 · 0 评论 -
CodeForces - 665A (组队赛第七场)
Buses run between the citiesAandB, the first one is at 05:00 AM and the last one departs not later than at 11:59 PM. A bus from the cityAdeparts everyaminutes and arrives to the cityBin ata...原创 2019-04-19 11:16:33 · 363 阅读 · 0 评论 -
hdu6438(2018中国大学生程序设计竞赛 - 网络选拔赛)(优先队列+贪心)
The Power Cube is used as a stash of Exotic Power. There arencities numbered1,2,…,nwhere allowed to trade it. The trading price of the Power Cube in thei-th city isaidollars per cube. Noswal is...原创 2019-04-08 17:02:51 · 314 阅读 · 0 评论 -
C. Queen(思路题)
You are given a rooted tree with vertices numerated from11tonn. A tree is a connected graph without cycles. A rooted tree has a special vertex named root.Ancestors of the vertexiiare all vertic...原创 2019-04-01 13:39:35 · 790 阅读 · 0 评论 -
D. Colored Boots
There arennleft boots andnnright boots. Each boot has a color which is denoted as a lowercase Latin letter or a question mark ('?'). Thus, you are given two stringsllandrr, both of lengthnn. T...原创 2019-03-20 19:57:56 · 632 阅读 · 0 评论 -
C. Polycarp Restores Permutation(思路题)
An array of integersp1,p2,…,pnp1,p2,…,pnis called apermutationif it contains each number from11tonnexactly once. For example, the following arrays are permutations:[3,1,2][3,1,2],[1][1],[1,...原创 2019-03-20 16:15:23 · 541 阅读 · 0 评论 -
CF 题
C. Number of Waystime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou've got arraya[1], a[2], ..., a[n], consisting ofninteger...原创 2019-03-07 19:49:09 · 474 阅读 · 0 评论 -
D1. Toy Train (Simplified)(贪心)
This is a simplified version of the task Toy Train. These two versions differ only in the constraints. Hacks for this version are disabled.Alice received a set of Toy Train™ from Bob. It consists of...原创 2019-03-14 10:48:58 · 415 阅读 · 0 评论 -
E. New Year and Old Subsequence(线段树+DP)
传送门题意:在s[l~r]中减少最少的字符数,使得得到的字符串含有2017子序列,不含2016子序列。一共q次查询。思路:设状态0表示空串,状态1表示走到了状态”2”,状态2表示都到了”20”,状态3表示走到”201”,状态4表示走到”2017”。设f[i,j]表示在走到该区间之前走到了状态i,且在走完该区间后走到了状态j,最少需要删掉多少个字符。如果知道左右区间的状态的话这两个矩阵显...原创 2019-09-09 21:23:44 · 387 阅读 · 0 评论