
CodeForces
Huffman_Tree_
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Codeforces Round #640 C. K-th Not Divisible by n
C. K-th Not Divisible by ntime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two positive integers n and k. Print the k-th positive integer that is not divisible by n.For example, if n=3原创 2020-05-12 20:06:42 · 345 阅读 · 0 评论 -
Codeforces 1332 C. K-Complete Word
C. K-Complete Wordtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputWord s of length n is called k-complete ifs is a palindrome, i.e. si=sn+1−...原创 2020-04-01 14:41:53 · 604 阅读 · 0 评论 -
Codeforces 1332 B. Composite Coloring
B. Composite Coloringtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputA positive integer is called composite if it can be represented as a pro...原创 2020-04-01 14:38:01 · 467 阅读 · 0 评论 -
Codeforces 1332 A. Exercising Walk
A. Exercising Walktime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputAlice has a cute cat. To keep her cat fit, Alice wants to design an exercis...原创 2020-04-01 14:05:28 · 314 阅读 · 0 评论 -
Codeforces Global Round 7 D1. Prefix-Suffix Palindrome (Hard version)
D2. Prefix-Suffix Palindrome (Hard version)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is the hard version of the problem. The diffe...原创 2020-03-21 00:23:17 · 466 阅读 · 1 评论 -
Codeforces Round #628 (Div. 2) C. Ehab and Path-etic MEXs
思路:map <int,bool> q;int t,n;int u[100020],v[100020],w[100020];int ind[100020];int main() { scanf("%d",&n); for(int i=1; i<n; i++) { cin>>u[i]>>v[i]; ...原创 2020-03-15 09:58:23 · 171 阅读 · 0 评论 -
Codeforces Round #628 (Div. 2) D. Ehab the Xorcist(数学)
思路:int main() { ll x,y,u,v; cin>>u>>v; if((v-u)%2!=0) cout<<-1<<endl; else{ if(v-u>0){ x=(v-u)/2; y=(v+u)/2; ...原创 2020-03-15 09:12:51 · 329 阅读 · 0 评论 -
Educational Codeforces Round 83 (Rated for Div. 2) D. Count the Arrays
等补题原创 2020-03-10 01:01:51 · 243 阅读 · 0 评论 -
Ozon Tech Challenge 2020 (Div.1 + Div.2, Rated, T-shirts + prizes!) (同余 抽屉定理)
time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTo become the king of Codeforces, Kuroni has to solve the following problem.He is given n numb...原创 2020-03-04 13:56:32 · 309 阅读 · 0 评论 -
Codeforces Round #625 (Div. 2, based on Technocup 2020 Final Round) C. Remove Adjacent(贪心)
思路:给定长度为n的字符串,规定操作——某一字符的前一位或者后一位的字符在字典序中比它小一,那么就可以删除这个字符,问最多可以删除多少个字符贪心思路,每次按字典序递减的顺序从字符串内查找进行删除处理,进行递归就可以得到最大操作数ll n,t,s;char x[1000010];int main() { scanf("%lld\n",&n); cin>&...原创 2020-03-03 21:39:43 · 156 阅读 · 0 评论 -
Codeforces Round #580 (Div. 2) C. Almost Equal (思维+数学)
题意:给定n,在一个2n多边形内满足相邻三条边x,a,b,y满足x+a+b=a+b+y+1或者x+a+b=a+b+y-1n为奇数的时候可以满足,为偶数的时候不满足输出NOtypedef long long ll;const ll maxn=2e5+10;ll n,a[maxn];int main() { scanf("%lld",&n); if(n&...原创 2020-02-26 22:18:30 · 259 阅读 · 0 评论 -
Codeforces Round #580 (Div. 2) D. Shortest Cycle (floyd求最小环)
You are given n integer numbers a1,a2,…,an. Consider graph on n nodes, in which nodes i, j (i≠j) are connected if and only if, ai AND aj≠0, where AND denotes the bitwise AND operation.Find the length...原创 2020-02-26 21:09:12 · 156 阅读 · 0 评论 -
Codeforces Round #623 (Div. 2, based on VK Cup 2019-2020 - Elimina F. Moving Points (树状数组)
F. Moving Pointstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThere are n points on a coordinate axis OX. The i-th point is located at the ...原创 2020-02-26 01:09:54 · 294 阅读 · 0 评论 -
Codeforces Round #623 (Div. 2, based on VK Cup 2019-2020 - Elimina D. Recommendations(并查集)
time limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputVK news recommendation system daily selects interesting publications of one of n disjoint cate...原创 2020-02-24 16:29:14 · 474 阅读 · 0 评论 -
Codeforces Round #575 (Div. 3) D2. RGB Substring (hard version)
time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe only difference between easy and hard versions is the size of the input.You are given...原创 2020-02-23 15:47:57 · 280 阅读 · 0 评论 -
Codeforces Round #544 (Div. 3) E. K Balanced Teams(DP)
time limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are a coach at your local university. There are n students under your supervision, the pro...原创 2020-02-22 21:53:51 · 215 阅读 · 0 评论 -
Codeforces Round #545 (Div. 2) D. Camp Schedule(KMP next数组使用)
time limit per test1 secondmemory limit per test512 megabytesinputstandard inputoutputstandard outputThe new camp by widely-known over the country Spring Programming Camp is going to start soon. H...原创 2020-02-22 19:45:05 · 167 阅读 · 0 评论 -
Codeforces Round #620 (Div. 2) C. Air Conditioner
DiscriptionGildong owns a bulgogi restaurant. The restaurant has a lot of customers, so many of them like to make a reservation before visiting it.Gildong tries so hard to satisfy the customers that...原创 2020-02-16 22:46:28 · 333 阅读 · 0 评论 -
Educational Codeforces Round 81 (Rated for Div. 2) D. Same GCDs
time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given two integers a and m. Calculate the number of integers x such that 0≤x<m and ...原创 2020-01-30 01:32:19 · 253 阅读 · 0 评论 -
Codeforces Round #614 (Div. 2) A. ConneR and the A.R.C. Markland-N
A. ConneR and the A.R.C. Markland-Ntime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSakuzyo - ImprintingA.R.C. Markland-N is a tall building w...原创 2020-01-20 01:43:59 · 239 阅读 · 0 评论 -
Educational Codeforces Round 80 (Rated for Div. 2) B. Yet Another Meme Problem
time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTry guessing the statement from this picture http://tiny.cc/ogyoiz.You are given two integers ...原创 2020-01-15 01:07:30 · 264 阅读 · 0 评论 -
codeforces 1285 B Just Eat It!(最大连续子段和)
B. Just Eat It!time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputToday, Yasser and Adel are at the shop buying cupcakes. There are n cupcake typ...原创 2020-01-14 20:41:18 · 702 阅读 · 0 评论 -
CodeForces 1265C --- Beautiful Regional Contest
time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputSo the Beautiful Regional Contest (BeRC) has come to an end! n students took part in the conte...原创 2019-12-08 17:22:52 · 286 阅读 · 0 评论 -
Codeforces Round #604 (Div. 2) B Beautiful Numbers(思维)
time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a permutation p=[p1,p2,…,pn] of integers from 1 to n. Let’s call the number m (1≤...原创 2019-12-07 17:09:36 · 187 阅读 · 0 评论 -
Codeforces Round #603 (Div. 2) B. PIN Codes(模拟)
time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputA PIN code is a string that consists of exactly 4 digits. Examples of possible PIN codes: 7013,...原创 2019-11-30 19:52:38 · 156 阅读 · 0 评论 -
[Codeforces Round #601 (Div. 2)]C. League of Leesins(模拟)
C. League of Leesinstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBob is an avid fan of the video game “League of Leesins”, and today he ce...原创 2019-11-27 21:24:37 · 253 阅读 · 0 评论 -
Codeforces Round #600 (Div. 2) Single Push
time limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou’re given two arrays a[1…n] and b[1…n], both of the same length n.In order to perform a pus...原创 2019-11-17 14:12:04 · 368 阅读 · 0 评论 -
Codeforces - 272C k-Multiple Free Set(练手快乐题)
A k-multiple free set is a set of integers where there is no pair of integers where one is equal to another integer multiplied by k. That is, there are no two integers x and y (x < y) from the set,...原创 2019-08-31 10:16:33 · 262 阅读 · 0 评论 -
CodeForces 233B Non-square Equation
Let’s consider equation:x2 + s(x)·x - n = 0, where x, n are positive integers, s(x) is the function, equal to the sum of digits of number x in the decimal number system.You are given an integer n, ...原创 2019-08-01 08:49:10 · 137 阅读 · 0 评论 -
CodeForces - 218C Ice Skating
**Ice Skating**Bajtek is learning to skate on ice. He’s a beginner, so his only mode of transportation is pushing off from a snow drift to the north, east, south or west and sliding until he lands ...原创 2019-07-23 09:35:39 · 230 阅读 · 0 评论 -
Codeforces Round #145 (Div. 2) C. Weather
题目链接:http://codeforces.com/problemset/problem/234/CScientists say a lot about the problems of global warming and cooling of the Earth. Indeed, such natural phenomena strongly influence all life on ou...原创 2019-07-31 10:21:18 · 199 阅读 · 0 评论 -
Codeforces 670C Array
You’ve got an array a, consisting of n integers: a1, a2, …, an. Your task is to find a minimal by inclusion segment [l, r] (1 ≤ l ≤ r ≤ n) such, that among numbers al, al + 1, …, ar there are exact...原创 2019-07-25 11:14:22 · 104 阅读 · 0 评论 -
codeforces 231B Magic, Wizardry and Wonders
Vasya the Great Magician and Conjurer loves all kinds of miracles and wizardry. In one wave of a magic wand he can turn an object into something else. But, as you all know, there is no better magic in...原创 2019-07-30 10:30:12 · 183 阅读 · 0 评论 -
CodeForces - 231D(暴力模拟的很厉害的归并优化的水题)
One day Vasya was going home when he saw a box lying on the road. The box can be represented as a rectangular parallelepiped. Vasya needed no time to realize that the box is special, as all its edges ...原创 2019-07-30 10:14:43 · 291 阅读 · 0 评论 -
Codeforces 670C Two Strings
A subsequence of length |x| of string s = s1s2… s|s| (where |s| is the length of string s) is a string x = sk1sk2… sk|x| (1 ≤ k1 < k2 < … < k|x| ≤ |s|).You’ve got two strings — s and t. Let’...原创 2019-07-25 10:04:12 · 214 阅读 · 0 评论 -
CodeForces 231C To Add or Not to Add(前缀和贪心 | | 二分)
A piece of paper contains an array of n integers a1, a2, …, an. Your task is to find a number that occurs the maximum number of times in this array.However, before looking for such number, you are al...原创 2019-07-30 09:54:35 · 189 阅读 · 0 评论 -
Codeforces 670C C. Cinema (排序+离散化)
Moscow is hosting a major international conference, which is attended by n scientists from different countries. Each of the scientists knows exactly one language. For convenience, we enumerate all lan...原创 2019-07-24 17:11:15 · 265 阅读 · 0 评论 -
CodeForces 221D Little Elephant and Array
Little Elephant and ArrayThe Little Elephant loves playing with arrays. He has array a, consisting of n positive integers, indexed from 1 to n. Let’s denote the number with index i as ai.Additionall...原创 2019-07-24 15:38:35 · 242 阅读 · 0 评论 -
codeforces 225E Unsolvable(梅森素数+快速幂)
Consider the following equation:z=[x/2]+y+x*y,where sign [a] represents the integer part of number a.Let’s find all integer z (z > 0), for which this equation is unsolvable in positive integers....原创 2019-07-29 10:15:16 · 238 阅读 · 0 评论 -
CodeForces - 227D Naughty Stone Piles(思维)
There are n piles of stones of sizes a1, a2, …, an lying on the table in front of you.During one move you can take one pile and add it to the other. As you add pile i to pile j, the size of pile j in...原创 2019-07-27 10:58:11 · 180 阅读 · 0 评论