codeforces
文章平均质量分 71
三级头不怕通
这个作者很懒,什么都没留下…
展开
-
CodeFroces cutting graphs 把图分成2条2条的边 DFS
啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊转载 2017-09-04 05:53:40 · 125 阅读 · 0 评论 -
Good Bye 2017 D.New Year and Arbitrary Arrangement - 数学
http://www.voidcn.com/article/p-qeitlhhb-bro.html无穷概率的题目 但是有两个概率 p 和 q 且 p = 1-q,利用等比数列性质,可以计算转载 2018-09-04 20:04:03 · 91 阅读 · 0 评论 -
CodeForces 906C Party(状压dp)
参考:https://blog.csdn.net/u013534123/article/details/78887346C. Partytime limit per test:1 secondmemory limit per test:256 megabytesinput:standard inputoutput:standard outputArseny likes to...原创 2018-08-31 04:37:15 · 217 阅读 · 0 评论 -
负下标数组 Codeforces-916B:Jamie and Binary Sequence (changed after round)(思维)
转的 链接忘了 题意:给出n和k,求把n分为k个数的2的幂的和的分法,而且要求最大字典序,且最大的数尽可能多;不行的话输出No;可以的话先输出Yes,在输出序列;#include<bits/stdc++.h>using namespace std;long long n,k;int a[100200],*cnt=a+100000;int main(){ cnt[-...转载 2018-08-17 01:15:55 · 144 阅读 · 0 评论 -
1023D. Array Restoration
#include<bits/stdc++.h>using namespace std;#define ll long long#define dprintf if (debug) printf#define rep(i, j, k) for (int i=j; i<k; i++)const int debug = 0;const int maxn = 2e5+50;...原创 2018-08-18 12:39:08 · 139 阅读 · 0 评论 -
CF916D Jamie and To-do List 主席树 留坑
https://www.luogu.org/problemnew/solution/CF916DD. Jamie and To-do Listtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputWhy I ...原创 2018-08-17 22:04:29 · 442 阅读 · 2 评论 -
Codeforces 989E A Trance of Nightfall 矩阵快速幂+DP
改编自Codeforces 989E A Trance of Nightfall 矩阵快速幂+DP题意:二维平面上右一点集SS,共nn个元素,开始位于平面上任意点PP,PP不一定属于SS,每次操作为选一条至少包含SS中两个元素和当前位置PP的直线,每条直线选取概率相同,同一直线上每个点Q \in SQ∈S 选取概率相同,QQ次询问 包含两个元素t,mt,m 即点PP到tt共操作mm次的最大概...原创 2018-08-12 22:55:41 · 299 阅读 · 0 评论 -
Codeforces 1020C. Elections 枚举
C. Electionstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs you know, majority of students and teachers of Summer Informatics...原创 2018-08-12 04:48:27 · 1073 阅读 · 4 评论 -
Codeforces edu#46 E.We Need More Bosses (无向图tarjan缩点+树的直径)
转载请注明出处:http://tokitsukaze.live/题目链接:http://codeforces.com/problemset/problem/1000/E题意:一条路径上必经的边为关键边,现在让你找一条路径,使得其关键边最多,输出最多的数量。(无向图注意判断返祖)题解:如果一条路径上面有环,那么这个环的任意一条边都不是关键边。所以先缩点,缩点完变成一棵树,那么在一棵树上...转载 2018-08-07 15:36:47 · 124 阅读 · 0 评论 -
codeforces 915C Permute Digits (枚举)
https://blog.csdn.net/zuzhiang/article/details/79076522传送门:Permute Digits 题目大意:给你两个数 a和 b,可以打乱 a每位数的顺序,让你求满足 <=b 的最大值。保证结果一定存在。 思路:由于结果一定存在,只有 b 的位数大于或等于 a 两种情况,如果 b 的位数大于 a 时,将 a 的每...原创 2018-09-04 21:22:59 · 179 阅读 · 0 评论 -
Codeforces 1027C. Minimum Value Rectangle
https://blog.csdn.net/qq_40727946/article/details/81841865C. Minimum Value Rectangle题目链接time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstan...原创 2018-09-05 05:07:27 · 122 阅读 · 0 评论 -
Codeforces Round #511 (Div. 1) C. Region Separation(dp + 数论)
转自:https://www.cnblogs.com/zjp-shadow/p/9773420.html这个代码太6了#include <bits/stdc++.h>#define For(i, l, r) for(register int i = (l), i##end = (int)(r); i <= i##end; ++i)#define Fordown(i...转载 2019-03-07 12:06:28 · 335 阅读 · 0 评论 -
Codeforces 983E NN country 倍增 树状数组
http://codeforces.com/contest/983/problem/E E. NN countrytime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputIn the NN country, ...原创 2019-02-14 06:10:05 · 284 阅读 · 0 评论 -
Codeforces 983D Arkady and Rectangles 扫描线?
这篇文章写得挺好:https://blog.csdn.net/Tiw_Air_Op1721/article/details/84038246但是关于mn的作用没写全-。-D. Arkady and Rectanglestime limit per test4 secondsmemory limit per test256 megabytesinputstandard...翻译 2019-02-09 07:13:06 · 207 阅读 · 0 评论 -
Codeforces Round #304 (Div. 2) D. Soldier and Number Game 数学 一个数最大可分成多少质因数
惯例抄qsc,不解释了。。。https://www.cnblogs.com/qscqesze/p/4523625.htmlD. Soldier and Number GameTime Limit: 20 Sec Memory Limit: 256 MB题目连接http://codeforces.com/contest/546/problem/DDescriptionTw...转载 2018-09-20 04:49:26 · 131 阅读 · 0 评论 -
IndiaHacks 2016 - Online Edition (Div. 1 + Div. 2) E. Bear and Forgotten Tree 2 bfs set 反图的生成树 快速连通块
老规矩,抄一波QSC,自己的写在后面 E. Bear and Forgotten Tree 2题目连接:http://www.codeforces.com/contest/653/problem/EDescriptionA tree is a connected undirected graph consisting of n vertices and n - 1 e...转载 2018-09-20 03:42:09 · 153 阅读 · 0 评论 -
Codeforces 675D Tree Construction (splay)
转自:https://blog.csdn.net/dreamon3/article/details/51436043题意往一个根为a[0]的二叉搜索树里面插数,每插一个数就输出他的父节点。思路根据二叉搜索树的性质,我们插进去一个数,他的父节点肯定是比他小的最大的和比他大的最小的数里面的两个,然后这两个节点找最深的那个就是他的父节点,我们可以给这些节点设置一个时间戳就能判断先后顺序...转载 2018-09-13 05:02:50 · 129 阅读 · 0 评论 -
【CF908E】New Year and Entity Enumeration
https://www.cnblogs.com/CQzhangyu/p/8227408.htmlhttp://www.mamicode.com/info-detail-2146477.html题意:给定M=2m−1M=2m−1,我们称一个集合S是好的,当且仅当它满足:1.∀a∈S,a xor M∈S∀a∈S,a xor M∈S,2.∀a,b∈S,a and b∈S∀a,b∈S,a and...转载 2018-09-05 11:19:34 · 210 阅读 · 0 评论 -
codeforces 1037E-Trips 【拓扑序与set的结合】
http://www.cnblogs.com/wa007/p/9578320.html题目:戳这里题意:n个点,每天早上会在这n个点中加一条边,每天晚上最大的子图满足子图中每个点都有k条或以上的边。STL的强大不得不服,应该还有更优的做法 倒着查询,刚开始把所有边和点都考虑在内,之后依次从后往前删边,然后删除不符条件的点 重点在于如何删除不符合条件的点,我用set&l...转载 2018-09-05 08:38:01 · 359 阅读 · 0 评论 -
Codeforces Round#489 div2E Nastya and King-Shamans (线段树+暴力剪枝)
转载请注明出处:http://tokitsukaze.live/题目链接:http://codeforces.com/problemset/problem/992/E题意:给一个序列a,q次操作。每次操作单点修改。每次操作后,询问序列a中有没有一个位置满足a[i]=bit[i-1],如果有,随便输出一个位置,如果没有输出-1。其中bit为前缀和数组。题解:容易想到建立线段树维护a[i...转载 2018-08-06 23:18:04 · 157 阅读 · 0 评论 -
codeforces 992D. Nastya and a Game【思维】
https://blog.csdn.net/Haipai1998/article/details/80740649Nastya and a Game题意:给定一个Arr[n],求满足multipul[L,R]/sum[L,R]==k的区间个数思路:对于a[i]==1的情况,因为对multipul是没有影响的,只影响L,R。那么对于连续的区间1我们就可以跳,只要sum[L,R]∈[sum...转载 2018-08-06 17:53:04 · 265 阅读 · 0 评论 -
stl Rope
stl::rope 基本操作与应用Rope是类似块状链表的结构。把每个子字符串作为结点,串连为一个字符串,这样做,可以节省内存,避免了字符串构造时需要反复地构建:str = A+B+C, D= A+B, E= D+C, str= E。String是“细线”,而Rope是“重绳”,用于解决巨型字符串的问题。http://www.sgi.com/tech/stl/Rop转载 2018-02-05 12:44:56 · 426 阅读 · 0 评论 -
Codeforces 2A Winner 迭代器陷阱
A. Winnertime limit per test1 secondmemory limit per test64 megabytesinputstandard inputoutputstandard outputThe winner of the card game popular in Berland "Berlogging" is determined...原创 2018-02-09 06:28:45 · 377 阅读 · 0 评论 -
codeforces 894d Ralph And His Tour in Binary Country
D. Ralph And His Tour in Binary CountryRalph is in the Binary Country. The Binary Country consists of n cities and (n - 1) bidirectional roads connecting the cities. The roads are numbered from 1 to (转载 2018-01-19 04:56:57 · 169 阅读 · 0 评论 -
Codeforces 887E Little Brothers 过两点的圆和给定的圆的关系 二分搜索
E. Little Brothertime limit per test3 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputMasha's little brother draw two points on原创 2017-11-28 11:14:36 · 336 阅读 · 0 评论 -
Codeforces 894 B. Ralph And His Magic Field
B. Ralph And His Magic Fieldtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputRalph has a magic field which i原创 2017-11-21 00:57:06 · 317 阅读 · 0 评论 -
Codeforces 892/E Envy 最小生成树的query
E. Envytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputFor a connected undirected weighted graph G, MST (m原创 2017-11-20 13:59:11 · 670 阅读 · 0 评论 -
Codeforces Round 444 div2 D two pointer + 贪心
D. Ratings and Reality Showstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are two main kinds of ev原创 2017-11-05 12:58:15 · 542 阅读 · 0 评论 -
cf723D 连通块
#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<vector>#include<queue>using namespace std;typedef long long ll;struct node{ int cost, x, y; node(int cost0原创 2017-10-23 01:59:25 · 208 阅读 · 0 评论 -
Codeforces 7E 宏是否安全
E. Defining Macrostime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputMost C/C++ programmers know about excell转载 2018-02-05 13:10:50 · 204 阅读 · 0 评论 -
Разбор Codeforces Round #461 (Div. 2) C & D
C. Cave Paintingtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputImp is watching a documentary about cave painting.Some numbers, carved in chaotic o...原创 2018-02-09 16:30:52 · 549 阅读 · 1 评论 -
Codeforces 933C+D C. A Colourful Prospect D. A Creative Cutout
https://blog.csdn.net/qq_28954601/article/details/79329961C. A Colourful Prospecttime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFirecrackers scare...翻译 2018-07-16 15:11:51 · 759 阅读 · 0 评论 -
codeforces 15 C&D&E
C. Industrial Nimtime limit per test2 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputThere are n stone quarries in Petrograd.原创 2018-02-24 12:19:51 · 166 阅读 · 0 评论 -
Codeforces Round 465 div.2 C&D
C. Fifa and Fafatime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputFifa and Fafa are sharing a flat. Fifa loves video games and wants to download a ne...原创 2018-02-23 03:25:12 · 166 阅读 · 0 评论 -
codeforces11D
D. A Simple Tasktime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputGiven a simple graph, output the number of simple cycles in it. A simple cycle is ...原创 2018-02-23 00:14:15 · 152 阅读 · 0 评论 -
有向图最小环 floyd 和暴力bfs
Kessel Runlockedby masonsbroProblemSubmissionsLeaderboardDiscussionsEditorialHan Solo wants to improve the reputation of the Millenium Falcon by completing more Kessel Runs! How does he complete these...原创 2018-02-10 12:59:05 · 764 阅读 · 0 评论 -
Codeforces 10 D. LCIS
D. LCIStime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis problem differs from one which was on the onlin原创 2018-02-12 14:15:16 · 184 阅读 · 0 评论 -
Codeforces 10C. Digital Root
C. Digital Roottime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputNot long ago Billy came across such a problem, where there were given three natural...原创 2018-02-12 04:21:36 · 247 阅读 · 0 评论 -
Codeforces 8E
E. Beadstime limit per test5 secondsmemory limit per test64 megabytesinputstandard inputoutputstandard outputOne Martian boy called Zorg wants to present a string of beads to his friend from the Earth...原创 2018-02-11 08:39:58 · 290 阅读 · 0 评论 -
codeforces Round 572 F. Array Beauty
https://www.luogu.org/problemnew/solution/CF1188Chttps://blog.csdn.net/huayunhualuo/article/details/95616635更正一下第二篇dp[index][len] ,前index个数长度为len的子序列的个数。关键是得想明白差分 哈哈C. Array Beauty...原创 2019-07-20 15:09:40 · 191 阅读 · 0 评论