• Codeforces Round #379 (Div. 2) E. Anton and Tree

    时间:2024-05-01 09:06:17

    题意:给一颗树 每个节点有黑白2色可以使一个色块同事变色,问最少的变色次数。思路:先缩点 把一样颜色的相邻点 缩成一个然后新的树 刚好每一层是一个颜色。最后的答案就是树的直径/2不过我用的树上的dp,强行求了以每个点为根时树的深度答案就是最小的深度-1具体见代码:const int maxn = ...

  • Codeforces Round #225 (Div. 1) C. Propagating tree dfs序+树状数组

    时间:2024-04-30 08:37:50

    C. Propagating treeTime Limit: 20 SecMemory Limit: 256 MB题目连接http://codeforces.com/contest/383/problem/CDescriptionIahub likes trees very much. Recent...

  • CodeForces - 803F: Coprime Subsequences(莫比乌斯&容斥)

    时间:2024-04-29 09:53:26

    Let's call a non-empty sequence of positive integers a1, a2... ak coprime if the greatest common divisor of all elements of this sequence is equal to ...

  • Codeforces Round #260 (Div. 1) D. Serega and Fun 分块

    时间:2024-04-27 17:42:30

    D. Serega and FunTime Limit: 20 SecMemory Limit: 256 MB题目连接http://codeforces.com/contest/455/problem/DDescriptionSerega loves fun. However, everyone h...

  • Codeforces Round #260 (Div. 2) C

    时间:2024-04-27 17:32:51

    DescriptionAlex doesn't like boredom. That's why whenever he gets bored, he comes up with games. One long winter evening he came up with a game and de...

  • Codeforces Round #260 (Div. 1) 455 A. Boredom (DP)

    时间:2024-04-27 17:22:20

    题目链接:http://codeforces.com/problemset/problem/455/AA. Boredomtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputsta...

  • Codeforces Round #260 (Div. 1) C. Civilization 并查集,直径

    时间:2024-04-27 17:15:32

    C. CivilizationTime Limit: 20 SecMemory Limit: 256 MB题目连接http://codeforces.com/contest/455/problem/CDescriptionAndrew plays a game called "Civilizatio...

  • Codeforces Round #260 (Div. 1) A - Boredom DP

    时间:2024-04-27 16:56:13

    A. BoredomTime Limit: 20 SecMemory Limit: 256 MB题目连接http://codeforces.com/contest/455/problem/ADescriptionAlex doesn't like boredom. That's why whenev...

  • Codeforces Round #260 (Div. 2)AB

    时间:2024-04-27 16:33:05

    http://codeforces.com/contest/456/problem/AA. Laptopstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard ou...

  • Codeforces Round #364 (Div. 2) C. They Are Everywhere 尺取法

    时间:2024-04-23 18:20:50

    C. They Are Everywheretime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSergei B., the young coach...

  • CodeForces 125E MST Company

    时间:2024-04-22 11:00:35

    E. MST Companytime limit per test 8 secondsmemory limit per test 256 megabytesinput standard inputoutput standard outputThe MST (Meaningless State Tea...

  • CODEFORCES #272 DIV2[为填完]

    时间:2024-04-21 07:50:43

    #272是自己打的第一场cf,感觉这一套质量挺棒的,不像后两场略水//先附上A,B,C的题解,因为离noip只剩下一点时间了,所以之后不一定还刷cf,暂且就先放上前三题好了A题目大意忘了。懒得看,反正很水。B组合数学:题目大意:给你两个字符串;s1,s2其中s2字符串可能含有未知的字符,对于未知的字...

  • CodeForces - 1249E 楼梯和电梯

    时间:2024-04-20 15:33:52

    题意:第一行输入n和c,表示有n层楼,电梯来到需要时间c输入两行数,每行n-1个,表示从一楼到二楼,二楼到三楼.....n-1楼到n楼,a[ ] 走楼梯和 b[ ] 乘电梯花费的时间思路:动态规划,考虑几种状态,假设当前在i-1层,想要去i层,有两种方法,乘电梯,走楼梯。i-1层要考虑由什么状态到i...

  • Codeforces1102F Elongated Matrix 【状压DP】

    时间:2024-04-20 15:11:56

    题目分析:这题瞎搞一个哈密尔顿路,对于起点不同的分开跑就可以过了。$O(n^3*2^n)$ #include<bits/stdc++.h> using namespace std; const int maxn = ; const int maxm = ; int n,m; int a[...

  • Codeforces Round 924 (Div. 2) ---- F. Digital Patterns ---- 题解

    时间:2024-04-19 07:05:16

    F. Digital Patterns: 题目描述:   思路解析: 要求在一个方块中,任意相邻的方块中他的透明度系数不能相同,这样的方块称为趣味性方块,问这样的方块有多少种。 那么我们可以相当,假设 a1 == a2, 那么每一列的第一行元素都等于第二行元素。  假设b1==b2,那么每一行的第...

  • codeforces 192a

    时间:2024-04-17 20:40:14

    link: http://codeforces.com/contest/330/problem/Abrute force. /* ID: zypz4571 LANG: C++ TASK: 191a.cpp */ #include <cstdio> #include <cstdli...

  • Codeforces Round 931 (Div. 2)

    时间:2024-04-17 16:59:53

    Codeforces Round 931 (Div. 2) Codeforces Round 931 (Div. 2) A. Too Min Too Max 题意: 从n个元素中选取四个元素进行按任意顺序排列,进行以下计算,求出可能的最大值 ...

  • Codeforces Round #250 (Div. 1) D. The Child and Sequence 线段树 区间取摸

    时间:2024-04-16 22:12:22

    D. The Child and SequenceTime Limit: 20 SecMemory Limit: 256 MB题目连接http://codeforces.com/contest/438/problem/DDescriptionAt the children's day, the ch...

  • Codeforces Round #200 (Div. 1) C. Read Time 二分

    时间:2024-04-16 11:42:53

    C. Read TimeTime Limit: 1 SecMemory Limit: 256 MB题目连接http://codeforces.com/contest/343/problem/CDescriptionMad scientist Mike does not use slow hard d...

  • Codeforces Round #360 (Div. 2) C D E

    时间:2024-04-16 10:51:14

    每次AB秒出 到了C难度陡然上升...翻译都弄不懂...C 给出一张图 找出两个点的覆盖集(覆盖集是指这图中每条边都有至少一个点在这个点集里面) 并且两个点集没有交集 英文很难看懂...就是二分图的判定 看看这张图是不是二分图 输出两边的点 不是二分图输出-1坑点是这是special judge 但...