随笔分类 - CodeForces
摘要:Figure: The house floats up in the sky by balloons. This picture is also used in 2018 KAIST RUN Spring Contest poster. In the year 2117, Professor Jae
阅读全文
摘要:A string is palindrome, if the string reads the same backward and forward. For example, strings like "a", "aa", "appa", "queryreuq" are all palindrome
阅读全文
摘要:B .Aesthetics in poetry 题意:给定N个数,(N<2000 ,a[i] <=1e9),让你找一个最大的K,使得N个数膜K的余数个数全都等于N/K个。 思路:我们找到N的因子,然后验证即可,复杂度O(N^2) #include<bits/stdc++.h> #define rep
阅读全文
摘要:这几天睡眠时间都不太够,室友晚上太会折腾了,感觉有点累,所以昨天的题解也没写,看晚上能不能补起来。 B . Marbles 题意:给定N组数(xi,yi),玩家轮流操作,每次玩家可以选择其中一组对其操作,可以把它减去一个数,或同时减去一个数,当玩家操作后出现了(0,0)则胜利。 思路:注意这里是出现
阅读全文
摘要:(本套题算是比较温和吧,就是罚时有点高。 B .Baby Bites 题意:给出一个婴儿给出的数组,有一些数字听不清楚,让你还原,问它是否是一个从1开始的一次增加的数组。 思路:从左往右依次固定,看是否有矛盾即可。 #include<bits/stdc++.h> #define ll long lo
阅读全文
摘要:B .Battle Royale 题意:给你两个点A,B,以及一个圆S,保证两个点在圆外,且其连线与圆相交,求两点间最短距离。 思路:显然是要分别与圆相切,然后在圆弧想走,直到相交。 那么ans=与圆相交的直线距离+圆弧上的距离; 前者不难求。 后者的话有些抽象,因为不知道怎么取固定角度,但是如果想
阅读全文
摘要:整体来说,这一场的质量比较高,但是题意也有些难懂。 E.Electronic Circuit 题意: 给你N个点,M根线,问它是否是一个合法的电路。 思路: 一个合法的电路,经过一些串联并联关系,最后有一个点是正极,一个是负极,我们就来模拟这个串联的过程即可,并联的关系会因为我们使用了set而抵消,
阅读全文
摘要:题意:给定N个数,Q次询问,求区间最大异或和。 思路:一开始想的线性基+线段树。单次线性基合并的复杂度为20*20,结合线段树,复杂度为O(NlogN*20*20);显然,超时。 超时代码: #include<bits/stdc++.h> #define pb push_back #define r
阅读全文
摘要:You are given a tree consisting of n vertices. A number is written on each vertex; the number on vertex i is equal to ai . Let's denote the function g
阅读全文
摘要:You are given an array a1,a2,…,an of integer numbers. Your task is to divide the array into the maximum number of segments in such a way that: each el
阅读全文
摘要:Alex decided to try his luck in TV shows. He once went to the quiz named "What's That Word?!". After perfectly answering the questions "How is a pseud
阅读全文
摘要:Mitya and Vasya are playing an interesting game. They have a rooted tree with n vertices, and the vertices are indexed from 1 to n. The root has index
阅读全文
摘要:Misha walked through the snowy forest and he was so fascinated by the trees to decide to draw his own tree! Misha would like to construct a rooted tre
阅读全文
摘要:Makoto has a big blackboard with a positive integer n written on it. He will perform the following action exactly k times: Suppose the number currentl
阅读全文
摘要:Peterson loves to learn new languages, but his favorite hobby is making new ones. Language is a set of words, and word is a sequence of lowercase Lati
阅读全文
摘要:A permutation of size n is an array of size n such that each integer from 1 to n occurs exactly once in this array. An inversion in a permutation p is
阅读全文
摘要:All bus tickets in Berland have their numbers. A number consists of n digits (n is even). Only k decimal digits d1,d2,…,dk can be used to form ticket
阅读全文
摘要:Vasya is preparing a contest, and now he has written a statement for an easy problem. The statement is a string of length n consisting of lowercase La
阅读全文
摘要:As everyone knows, bears love fish. But Mike is a strange bear; He hates fish! The even more strange thing about him is he has an infinite number of b
阅读全文
摘要:You are running for a governor in a small city in Russia. You ran some polls and did some research, and for every person in the city you know whom he
阅读全文

浙公网安备 33010602011771号