• Codeforces CF#628 Education 8 C. Bear and String Distance

    时间:2023-12-15 15:49:27

    C. Bear and String Distancetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputLimak is a little pola...

  • cf 403 D

    时间:2023-12-14 19:09:35

    D. Beautiful Pairs of Numberstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe sequence of int...

  • 【做题】CF239E. k-d-sequence——线段树

    时间:2023-12-14 16:08:20

    首先,容易得到判断一个子串为“good k-d sequence”的方法:子串中没有重复元素,且所有元素模d相等。记mx为除以d的最大值,mn为除以d的最小值,则\(mx-mn<=r-l+k\)。然后,我们对于每一段极大的元素同模的子串,处理\(d=1\)的情况。显然,我们需要枚举一个端点。这...

  • CF 86D Powerful array 【分块算法,n*sqrt(n)】

    时间:2023-12-13 20:09:57

    给定一个数列:A1, A2,……,An,定义Ks为区间(l,r)中s出现的次数。t个查询,每个查询l,r,对区间内所有a[i],求sigma(K^2*a[i])离线+分块将n个数分成sqrt(n)块。对所有询问进行排序,排序标准:1. Q[i].left /block_size < Q[j]....

  • 【CF878D】Magic Breeding bitset

    时间:2023-12-13 18:30:39

    【CF878D】Magic Breeding题意:有k个物品,每个物品有n项属性值,第i个人的第j个属性值为aij,有q个操作:1 x y 用x和y合成一个新的物品,新物品的编号是++k,新物品的每项属性值为x和y的对应项的属性值中的较大值。2 x y 用x和y合成一个新的物品,新物品的编号是++k...

  • cf467B Fedor and New Game

    时间:2023-12-13 16:13:49

    B. Fedor and New Gametime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter you had helped George ...

  • cf723a The New Year: Meeting Friends

    时间:2023-12-13 14:52:27

    There are three friend living on the straight line Ox in Lineland. The first friend lives at the point x1, the second friend lives at the pointx2, and...

  • CF_402C Searching for Graph 乱搞题

    时间:2023-12-13 12:55:18

    题目链接:http://codeforces.com/problemset/problem/402/C/**算法分析: 乱搞题,不明白题目想考什么*/#include<bits/stdc++.h>#define MAXN 1050#define PI acos(-1.0)#defi...

  • cf14d 树的直径,枚举删边

    时间:2023-12-13 08:03:54

    #include<bits/stdc++.h>using namespace std;#define maxn 300struct Edge{int from,to,nxt,flag;}edge[maxn<<];int n,head[maxn],tot,a,b,dis[max...

  • [51nod][cf468D]1558 树中的配对

    时间:2023-12-12 08:37:37

    http://www.51nod.com/onlineJudge/questionCode.html#!problemId=1558不是很懂dalao们用线段树是怎么写的……反正找出重心以后每个子树一个堆,再来个全局堆就吼了#include<queue>#include<stdio...

  • cf515d

    时间:2023-12-11 09:17:29

    题意:给出一个矩阵迷宫,要求用1×2的积木填满空白区域,问解法是否唯一,如果无解或者多解均输出“Not unique"。分析:广搜。看似二分图匹配但实际上不是。我们认为每个点和上下左右四个点连接(只考虑空白的点)。先把度为1的点全部入队。每次弹出一个点a,把那个唯一与它链接的点b与a配对。切断b的所...

  • 洛谷CF1071E Rain Protection(计算几何,闵可夫斯基和,凸包,二分答案)

    时间:2023-12-10 19:39:31

    洛谷题目传送门CF题目传送门对于这题,我无力吐槽。虽然式子还是不难想,做法也随便口胡,但是一些鬼畜边界情况就是判不对。首先显然二分答案。对于每一个雨滴,它出现的时刻我们的绳子必须落在它上面。把绳子的上下端点用二元组\((a,b)\)表示,因为三个点\((a,0)(x_i,y_i)(b,h)\)共线,...

  • CF1101F Trucks and Cities

    时间:2023-12-10 17:54:09

    题意:给定线段上n个特殊点,m次询问。每次询问:在第l个点到第r个点这一段区间中选出k个点,将其分成k + 1段。使得最长的段尽量短。输出这m个询问中答案最大的。 n<=400,m<=250000解:显然有个暴力DP是n4的。f[l][r][k]表示把[l, r]分成k段的最短长度。然后...

  • cf1130E. Wrong Answer(构造)

    时间:2023-12-06 12:13:42

    题意题目链接Sol对构造一无所知。。。题解的方法比较神仙,,设第一个位置为\(-1\),\(S = \sum_{i=1}^n a_i\)那么我们要让\(N * S - (N - 1) * (S + 1) = K\)固定\(N\)之后可以直接解出\(S\)。。。#include<bits/std...

  • cf1133 bcdef

    时间:2023-12-06 08:26:03

    b所有数模k,记录出现次数即可#include<bits/stdc++.h>using namespace std;int main(){ int n,k,a[]; int cnt[]={}; cin>>n>>k; for(int i=;i...

  • CF1139B Chocolates

    时间:2023-12-03 18:58:28

    题目地址:CF1139B Chocolates前一个必须要少于后一个,那么模拟+贪心即可倒序模拟,每次在上次取的个数减一和这次可以取的最多数量之间取min直到为0(注意不要减到负数)再就是注意开long long#include <bits/stdc++.h>#define ll lon...

  • CF 17B Hierarchy

    时间:2023-12-03 17:02:11

    Nick's company employed n people. Now Nick needs to build a tree hierarchy of «supervisor-surbodinate» relations in the company (this is to say that e...

  • CF722D. Generating Sets[贪心 STL]

    时间:2023-12-03 12:12:48

    D. Generating Setstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a set Y of n dis...

  • CF461B Appleman and Tree (树DP)

    时间:2023-12-02 15:46:35

    CF462DCodeforces Round #263 (Div. 2) DCodeforces Round #263 (Div. 1) BB. Appleman and Treetime limit per test2 secondsmemory limit per test256 megabyt...

  • 【CF387D】George and Interesting Graph(二分图最大匹配)

    时间:2023-12-01 14:24:31

    题意:给定一张n点m边没有重边的有向图,定义一个有趣图为:存在一个中心点满足以下性质:1、除了这个中心点之外其他的点都要满足存在两个出度和两个入度。2、中心 u 需要对任意顶点 v(包括自己)有一条(u,v)的边和(v,u)的边,即他们都要互通。现在可以删除和添加边,使得给出的原图满足以上情况。询问...