Можно ввести несколько слов — все они попадут в требования к поиску. Кроме того, осуществляется поиск по словоформам и, если повезет, по синонимам. Поддерживается поиск по названию, автору и специальный синтаксис запросов. Примеры:

  • 305 — ищет все посты, содержащие 305, найдет посты про Раунд 305
  • andrew stankevich contests — можно писать сразу много слов, будут искаться все
  • user:mikemirzayanov title:сазанка — ищет все посты в названии со словом "сазанка" авторства MikeMirzayanov
  • "vk cup" — можно использовать кавычку, чтобы искать точные совпадения
  • title:educational — искать в названии

Результаты

1.
Автор parveen1981, история, 6 лет назад, По-английски
I compiled a list of almost all useful blogs ever published on Codeforces [update: till 09.06.2021] <h3 style="color:red">If there are any blogs that I have missed, please tell in the comment section. Thank you.</h3> # Mathematics Stuff - [Number Theory in Competitive Programming [Tutorial]](https://codeforces.me/blog/entry/46620) - [Number of points on Convex hull with lattice points](https://codeforces.me/blog/entry/62183) - [FFT, big modulos, precision errors.](https://codeforces.me/blog/entry/48465) - [Number of ways between two vertices](https://codeforces.me/blog/entry/19078) - [Mathematics For Competitive Programming](https://codeforces.me/blog/entry/76938) - [FFT and NTT](https://codeforces.me/blog/entry/19862) - [Burnside Lemma](https://codeforces.me/blog/entry/51272) - [Number of positive integral solutions of equation 1/x+1/y=1/n!](https://codeforces.me/blog/entry/76836) - [On burnside (again)](https://codeforces.me/blog/entry/64860) - [Simple but often unknown theorems/lemmas/formula? Do you know?](https://codeforces.me/blog/entry/55912) - [Probabili...
://codeforces.com/blog/entry/73687) - [[Tutorial] Math note — Dirichlet convolution](https://codeforces.com

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1500
  • Проголосовать: не нравится

2.
Автор Zhtluo, история, 3 года назад, По-английски
The Reason You are Bad at Codeforces — You are Not Russian Enough If you are triggered by this clickbaity blog title, you are probably interested in improving your Codeforces skills. Now, I will share my point of view on the differences between Codeforces and ICPC contests, and how you can, in my humble opinion, maximize your Codeforces rating gain. I mostly consider that all conceivable competitive programming problems need three aspects of skill: 1. Observation &mdash; the ability to understand the problem and come up with non-trivial properties. 2. Technique &mdash; the ability to apply a well-known algorithm or data structure to the problem. 3. Implementation &mdash; the ability to code fast and debug fast. Collaterally, I refer to these three skills as Russian-ness, Chinese-ness and American-ness, respectively, for reasons you will soon see below. ## Observation (Russian-ness) Observation means that you stare at some problem for a sufficient amount of time and you are able to reduce it to some easier problem. One good proble...
*Claim 2: Div. 2 A, B, and C require nothing but basic programming skills and goodmath skills.*, , and C require nothing but basic programming skills and good math skills.* This is more debatable

Полный текст и комментарии »

  • Проголосовать: нравится
  • +772
  • Проголосовать: не нравится

3.
Автор dacin21, история, 8 лет назад, По-английски
On the mathematics behind rolling hashes and anti-hash tests This blog assumes the reader is familiar with the basic concept of rolling hashes. There are some math-heavy parts, but one can get most of the ideas without understanding every detail. The main focus of this blog is on how to choose the rolling-hash parameters to avoid getting hacked and on how to hack codes with poorly chosen parameters. # Designing hard-to-hack rolling hashes ## Recap on rolling hashes and collisions Recall that a rolling hash has two parameters $(p, a)$ where $p$ is the modulo and $0 \leq a < p$ the base. (We'll see that $p$ should be a big prime and $a$ larger than the size $\left|\Sigma\right|$ of the alphabet.) The hash value of a string $S = s_0 \dots s_{n-1}$ is given by $$ h(S) := \left(\sum\limits_{i=0}^{n-1} a^{n-1-i} s_i\right) \mod p $$ For now, lets consider the simple problem of: given two strings $S, T$ of equal length, decide whether they're equal by comparing their hash values $h(S), h(T)$. Our algorithm declares $S$ and $T$ t...
This blog assumes the reader is familiar with the basic concept of rolling hashes. There are some

Полный текст и комментарии »

  • Проголосовать: нравится
  • +371
  • Проголосовать: не нравится

4.
Автор SanguineChameleon, история, 13 месяцев назад, По-английски
I've (also) completed Project Euler ###_I've been dreaming of writing this for so long._ --- About 2 years ago, [user:Radewoosh,2025-10-22] posted a [blog](https://codeforces.me/blog/entry/122793) celebrating that he had solved all 865 problems on Project Euler. As a (naively optimistic) high-schooler back then, I thought to myself: _"Surely it can't be that hard, right?"_ 2 years later, there are now 965 problems, and I've solved all of them!! ![ ](/predownloaded/79/01/79019d6682d1c09808c1a205d72c4f4f838eccd8.png) ![ ](/predownloaded/98/f6/98f6fbe17d73c4691ad803c2d0725569c47d0cfb.png) --- I can’t even begin to describe how happy I am, and how wonderful the journey has been. Maybe I’ll write about it in another blog sometime. For now, I’ll answer some questions you might be thinking... ####_Literally, who asked?_ No one, of course. But this achievement means a lot to me, and I hope that this post inspires someone out there. ####_How long did it take?_ Kind of a difficult question to ans...
sort of math genius!_ No. Not at all. In fact, I'm only taking my undergrad intro to calculus and

Полный текст и комментарии »

  • Проголосовать: нравится
  • +900
  • Проголосовать: не нравится

5.
Автор Um_nik, 8 лет назад, По-английски
How to read problem statements But [user:Um_nik,2018-10-26], we all know how to read, we have our whooping 2 month of experience! Oh, my sweet summer child, my experiments show that many people with kinda cool achievements like medals on ROI don't know how to read statements. But don't worry, I'll teach you. Well, probably you won't understand anything, because you didn't try to understand anything in your life, you expect all hard work to be done for you by someone else. Let's start! Basic rules ================== - The result of reading the statement is usually pure math model. If story helps to build correct understanding, you can keep it, but still try to discard as many unnecessary details as possible. - Imagine you want to tell the problem to someone else. What parts you want to tell? (According to my PM, this rule won't help you). - Shorter = better. - Simpler = better. - Limitations are part of problem statement. Especially small limitations, because for small data you can try all the possib...
hard work to be done for you by someone else. Let's start! Basic rules, Basic rules ================== - The result of reading the statement is usually puremath model

Полный текст и комментарии »

  • Проголосовать: нравится
  • +381
  • Проголосовать: не нравится

6.
Автор adamant, история, 5 лет назад, По-английски
On linear recurrences and the math behind them Hi everyone! There are already dozens of blogs on linear recurrences, why not make another one? In this article, my main goal is to highlight the possible approaches to solving linear recurrence relations, their applications and implications. I will try to derive the results with different approaches independently from each other, but will also highlight similarities between them after they're derived. ### Definitions **Def. 1**. An order $d$ **homogeneous linear recurrence with constant coefficients** (or _linear recurrence_) is an equation of the form $$ F_n = \sum\limits_{k=1}^d a_k F_{n-k}. $$ **Def. 2**. In the equation above, the coefficients $a_1, \dots, a_d \in R$ are called the **recurrence parameters**, **Def. 3**. and a sequence $F_0, F_1, \dots \in R$ is called an order $d$ **linear recurrence sequence**. <hr> The most common task with linear recurrences is, given initial coefficients $F_0, F_1, \dots, F_{d-1}$, to find the value of $F_n$. <hr> **Example...
On linear recurrences and the math behind them, be a linear combination of these basic solutions., combination of these basic solutions. For $d = 1$, the equation here is of form $$ \Delta F = \lambda

Полный текст и комментарии »

  • Проголосовать: нравится
  • +266
  • Проголосовать: не нравится

7.
Автор peltorator, 18 месяцев назад, По-английски
"Algorithms in Depth" Stream Series: Kicking Off With FFT Hi Codeforces! I’ve long believed that it's _really_ worth revisiting the same competitive programming topics multiple times. The first time, you’re just trying to survive and maybe grasp the basics. The second time, you’ve solved some problems, you know where you got confused, and you're ready to absorb more. By the third time, you’ve seen and solved enough to start appreciating the subtleties — the tricks, advanced applications, deeper meaning. But most lectures I’ve seen are designed as a one-size-fits-all — trying to cover everything from scratch _and_ dive into the advanced stuff in one go. That’s rarely optimal. Take binary search. I once talked about it for six hours straight. A beginner at that lecture would’ve probably quit CP immediately. And that’s ok. Beginners don’t need all that. But the truth is, there _is_ that much depth to explore even in seemingly simple topics like binary search — once you're ready. Yet many people only see the beginner version once and mo...
hard. It makes more sense to have: - A basic lecture: just enough to multiply polynomials with

Полный текст и комментарии »

  • Проголосовать: нравится
  • +631
  • Проголосовать: не нравится

8.
Автор Noble_Mushtak, история, 4 года назад, По-английски
Every Technique and Algorithm I Used to Become Grandmaster Hi everyone, I became grandmaster today so I decided to go down memory lane and review every problem I have ever done in a CodeForces contest to look back and see every technique and algorithm I had to use to become a grandmaster. I am not sure how useful this is, I mostly think it's fun to look at all the old solutions I wrote and how different it was from how I write code now. The main takeaway is that, as many people have said before, you don't need to know or memorize a bunch of advanced algorithms to become grandmaster. As you will see, there are many problems where I just used "ad hoc reasoning," meaning there's not a standard technique I used to solve the problem and you just need to make some clever mathematical observations to solve the problem. Also, there are many popular algorithms that I have never needed in a CodeForces contest despite being a grandmaster: - Sparse tables, Fenwick trees, and segment trees - String algos, like rolling hashes, Knuth-Morris-Pratt, suffix...
- [Problem A](https://codeforces.me/contest/1183/submission/56080739): Basic number theory, - [Problem A](https://codeforces.me/contest/697/submission/19115278): Ad hoc reasoning andmath, ://codeforces.com/contest/697/submission/19115278): Ad hoc reasoning and math - [Problem B](https

Полный текст и комментарии »

  • Проголосовать: нравится
  • +213
  • Проголосовать: не нравится

9.
Автор Wind_Eagle, история, 5 лет назад, По-русски
How to train: why it's not enough to just do a lot of tasks Hello, Codeforces! I, like many of you, read blogs periodically. Lately, blogs from low-rated users who ask me how to raise their ratings have been catching my attention. I want to tell you a little bit about my opinion on these blogs. So what do these blogs look like? Usually this is a blog with a title something like <b>"I need help right now!"</b> or <b>"How to improve my rating, help me!"</b> When you open this blog, you see the most detailed description of the problem, such as: "I have solved 500 problems, but no improvement" or "I have solved 100 problems with rating >= 1500, but my rating is not increasing". And in the comments they usually write "you haven't solved enough, solve more" or "solve more difficult problems". <b>In my opinion, this is incorrect and misleads such users. So, imagine that you do not know anything at all about sports programming, or even about the basics of Olympic math. You at best (because many people don't even do that) have learned a programmin...
basics of Olympic math. You at best (because many people don't even do that) have learned a, of Olympic math. You at best (because many people don't even do that) have learned a programming

Полный текст и комментарии »

  • Проголосовать: нравится
  • +268
  • Проголосовать: не нравится

10.
Автор EnDeRBeaT, 3 года назад, По-английски
[Tool] Graph Debugger Hi, CodeForces! For the past 2 months I have been working on a Graph Debugging tool, which allows you to draw graphs like these with just **TWO** lines of code: ![ ](/predownloaded/42/15/4215be4db6122c5583244a262d651c2dc5ae6b81.png) This is similar to print debugging (when you got a crash somewhere, so you repeatedly recompile the code with `cout << "penis\n";` to see where it failed), but instead it creates a window with the graph, which you can change however you want. It is also a marginally better tool than graph editor from CSAcademy in my opinion, so I would love you guys to try it out. This is not compatible with MacOS because Apple deprecated OpenGL (and even if it wasn't, it would've been kinda annoying to use) ## Building First, build the code from the repo: https://github.com/EnDeRGeaT/graph-debugger If you write in Visual Studio (not Visual Studio Code), follow "For MSVC" part. If you write in anything else, you probably should follow "For GCC/...
, and there are some basic algos in this graph (they are bad because i was writing them for my discrete, There are also ways to visualize with highlighted edges, and there are some basic algos in this

Полный текст и комментарии »

  • Проголосовать: нравится
  • +208
  • Проголосовать: не нравится

11.
Автор Everule, история, 4 года назад, По-английски
How to prove your solutions in Competitive Programming It seems many people struggle to understand what a proof even looks like, for greedy problems. The issue is the polarized forms of proof in CP and academic math, which may seem to be overly rigorous and difficult to during contest. However there is spectrum of what a proof even is. It is important to understand, that you cannot truly write and verify a proof within yourself, or within an entity (the entirety of codeforces for example). It is necessary to have judgement on what level of rigor is sufficient. If you want to tell yourself that you just don't have math background and therefore can't prove and will perpetually use it as excuse this blog is not for you. Academic proofs usually tend to be as rigorous as possible, and are carefully verified by other experts in the field, to be objectively certain of its correctness. Clearly that is not a level of rigor you need while solving a codeforces problem. You only need to prove it _to yourself._ For this, there are certain heu...
issue is the polarized forms of proof in CP and academic math, which may seem to be overly rigorous, But this is not really a proof you need in Competitive programming. This is necessary formath

Полный текст и комментарии »

  • Проголосовать: нравится
  • +343
  • Проголосовать: не нравится

12.
Автор Nisiyama_Suzune, 9 лет назад, По-английски
[Tutorial] Math note — Möbius inversion If you've ever taken some lessons on competitive programming, chances are that you have already heard about one of the most famous formula: the Möbius inversion. This article is aimed to provide some basic insight on what is the Möbius inversion, as well as how to apply it in various programming tasks. Prequisite ================== If you are not familiar with the linear sieve and multiplicative functions, it is recommended that you read about them first [here](http://codeforces.me/blog/entry/54090). I will introduce some frequently used notations and lemmas first. Notation ------------------ 1. $[P]$ refers to the boolean expression, i.e. $[P]=1$ when $P$ is true, and $0$ otherwise. 2. $\lfloor x \rfloor$ refers to rounding $x$ down to the nearest integer. Thus $\lfloor \frac{q}{p} \rfloor$ refers to the integer division. 3. $d|n$ means that d can divide n (without a remainder). The following functions are all multiplicative functions, where $p$ is a prime numbe...
[Tutorial] Math note — Möbius inversion, best to show the reasons in some basic examples below., basic insight on what is the Möbius inversion, as well as how to apply it in various programming

Полный текст и комментарии »

  • Проголосовать: нравится
  • +202
  • Проголосовать: не нравится

13.
Автор purplesyringa, история, 2 года назад, По-английски
We teach wrong When I was a child, I knew software development well (though not much of C++), and my parents motivated me to try out competitive programming. The first thing I tried was dkirienko's section. In the first 20 minutes, GCD and the Euclidian algorithm were explained, the complexity of the Euclidian algorithm was proven, and that was pretty much it. We were then asked to solve a problem set on Codeforces individually. I didn't understand much from the complexity proof, couldn't solve a single problem, failed to figure out what I was supposed to do, and left crying. So yeah, stuff like that doesn't work. I understood simpler topics, though. I knew basic math, like how to solve linear systems and quadratic equations, and could make simple observations, so the school stage of ROI was quite easy to get through. (The hardest part was to explain to my then-informatics teacher that yes, I want the adult problems.) During the municipal stage, I had 3 hours to solve what I'd classify as a 5-t...
doesn't work. I understood simpler topics, though. I knew basic math, like how to solve linear, I understood simpler topics, though. I knew basic math, like how to solve linear systems and

Полный текст и комментарии »

  • Проголосовать: нравится
  • +178
  • Проголосовать: не нравится

14.
Автор Esomer, история, 3 года назад, По-английски
Math and informatics competition, with prizes! Hello Codeforces! I am pleased to invite you to CAMA (Amateur Mathematical and Algorithmic Competition, the acronym comes from Spanish). CAMA is a mixed competition of mathematics and informatics founded by Spanish international medallists in those disciplines. Although the competition is mainly focused on Spanish students, it is open for everyone! The competition will be split in two divisions, basic and advanced. The basic division is intended for those who have never participated in a mathematics/informatics competition, while the advanced division is focused on contestants who are already veterans. Before signing up for a division, please note that you can only be eligible for prizes in the combined category if you have signed up for the advanced division in both mathematics and informatics, and winners of the basic divisions will receive fewer prizes. The mathematics competition will take place on October 21st at 19:00 CEST, while the informatics competition will be on Oc...
Math and informatics competition, with prizes!, divisions, basic and advanced. The basic division is intended for those who have never participated in a, mathematics and informatics categories also offer prizes to the winners of the basic divisions. Prize details, - Winner in the informatics basic division: 10€, - Winner in the mathemathics basic division: 10€, The competition will be split in two divisions, basic and advanced. The basic division is intended

Полный текст и комментарии »

  • Проголосовать: нравится
  • +78
  • Проголосовать: не нравится

15.
Автор jjang36524, 5 лет назад, По-английски
Tutorial and tips to reach Master. "As mentioned earlier, practice hard. This is the only common factor that experts have. And for whom reached expert, I'll write a sequel from expert to master soon." (From my blog, Tutorial and tips to reach Expert). That soon happened to be 1.5 years after the first blog...... First, I'm sorry for the immense delay. Many bad things happened to me, like not staying in the Master rating range, having a health problem, etc. That's why I wrote the blog this late. Introduction ------------------ This is a sequel, but I am going to write the steps to Expert from scratch since the original blog([https://codeforces.me/blog/entry/81882](https://codeforces.me/blog/entry/81882)) has poor quality. Your journey is going to be divided into 4 sections. Each section contains the knowledge you need to have, the practice you must do, the performance you need to have in a contest, etc to advance to the specific rating. Section 1. From the beginning to escaping Gray(1200) ---------------...
, and should be quite easy once you reach cyan. Topics on problem C are basic math and implementation, . Topics on problem C are basic math and implementation, and some computational thinking. Also, you can

Полный текст и комментарии »

  • Проголосовать: нравится
  • +72
  • Проголосовать: не нравится

16.
Автор jjang36524, история, 6 лет назад, По-английски
Tutorial and tips to reach Expert. Before the start of the blog, I'd like to thank [this blog](https://codeforces.me/blog/entry/53341) for motivating me to write it. However, this blog is quite outdated in many factors like the rating system, and people starting cp in 2020 may have trouble following these. Therefore, I would like to write new tips for doing well in codeforces. The goal is getting to expert, or rating 1600. I would write this in 3 steps, but the most important thing here is **Practicing hard**. You won't get to 1600 if you don't practice, you don't have to do it on the blog's way, but you should practice. Step 1: from 1000(grey) to 1200(green) ------------------ First, read [introduction to the new rating system](https://codeforces.me/blog/entry/77890) and judge your skill. Note that you'll need to take part in about 5 contests to judge your skill. If your rating is under 1200, read the next part and practice. If you use div3, you'll need to solve 3 problems in 30 minutes. That means you...
get to cyan, you should know basic dp, greedy, bit operation, and math. Other things such as graph, know basic dp, greedy, bit operation, and math. Other things such as graph theory are not required to

Полный текст и комментарии »

  • Проголосовать: нравится
  • +28
  • Проголосовать: не нравится

17.
Автор chromate00, 4 года назад, По-английски
Convex Optimization for CP, Part 1: What is Convex Optimization? **Before we begin: This blog is my attempt to [Codeforces Month of Blog Posts](https://codeforces.me/blog/entry/110840). Simple rule: Write an interesting CodeForces blog post until February 15th and win $300.** In this blog, I will be describing the concept of Convex Optimization, and techniques that can be used to solve Convex Optimization tasks. The blog will be divided into two parts &mdash; "What is Convex Optimization", and "How do we solve Convex Optimization tasks". This part of the blog is for "What is Convex Optimization". [(Part 2 is here)](https://codeforces.me/blog/entry/111048) -------- ### **What is Convex Optimization?** "A convex optimization problem is an optimization problem in which the **objective function is a convex function** and the **feasible set is a convex set**." as Wikipedia says. This may be hard to understand for many people, so let's use the simpler case of a univariate function. Often the "convex function" is called "unimodal function" in...
when $f'(x)=0$, $f(x)$ is either a maximum, a minimum, or a saddle point.** This is justbasic, This is just basic math, but this serves as a basis of [Newton's method in optimization](https

Полный текст и комментарии »

  • Проголосовать: нравится
  • +42
  • Проголосовать: не нравится

18.
Автор adamant, история, 4 года назад, По-английски
How to read my blogs Hi everyone! I saw that a lot of people write meta blogs recently. As my blog count approaches 90, I feel like it may make a lot of sense to write another one that kind of focuses on the philosophy behind my blogs and explains potential readers what they should expect from my blogs and how to approach them. So, without further ado... ##### Tldr. 1. Read my blogs if and only if the general setup itself appeals to you. Don't feel obliged to do it to get better at competitive programming. 2. Don't be driven away by seemingly dense math notation if the topic looks interesting. Ask questions if something is difficult to comprehend, I will explain in a more detail and it will help others too. 3. Be ready to fill some possible gaps in the story yourself, as an exercise. 4. Be open-minded about analyzing setup in general, rather than working towards predetermined goal. 5. Be prepared to see too little explanation on how abstract nonsense from my blogs connects with concrete applic...
that they require some very advanced math to comprehend. For example, it seems that many people, . 2. Don't be driven away by seemingly dense math notation if the topic looks interesting. Ask

Полный текст и комментарии »

  • Проголосовать: нравится
  • +52
  • Проголосовать: не нравится

19.
Автор taorunz, 12 лет назад, По-английски
Codeforces Round #278 Editorial [problem:488A] -------------- The answer $b$ is very small (usually no larger than $10$), because one of $a+1,a+2, \cdots, a+10$ has its last digit be $8$. However, $b$ can exceed $10$ when $a$ is negative and close to $0$. The worst case is $a=-8$, where $b=16$. Anyway $b$ is rather small, so we can simply try $b$ from $1$, and check whether $a+b$ has a digit 8. [problem:488B] -------------- Let's sort the four numbers in ascending order: $a, b, c, d$ (where $x_1,x_2,x_3,x_4$ are used in problem statement). So $\frac{a+b+c+d}{4}=\frac{b+c}{2}=d-a$. With some basic math, we can get $a:d=1:3$ and $a+d=b+c$. **Solution 1:** If $n=0$, just output any answer (such as ${1,1,3,3}$). If $n=1$, just output ${x,x,3x,3x}$, where $x$ is the known number. If $n=4$, just check whether the four known numbers meet the condition. If $n=2$, let $x,y$ denote the known numbers ($x \leq y$). No solution exists if $3x < y$. Otherwise we can construct a solution ${x,y,4x-y,3x}$ ...
$ are used in problem statement). So $\frac{a+b+c+d}{4}=\frac{b+c}{2}=d-a$. With somebasic math, With some basic math, we can get $a:d=1:3$ and $a+d=b+c$.

Полный текст и комментарии »

Разбор задач Codeforces Round 278 (Div. 2)
  • Проголосовать: нравится
  • +25
  • Проголосовать: не нравится

20.
Автор Nickolas, 12 лет назад, По-русски
Surprise Language Round #7: editorial #### [problem:470A] As usual, the first problem tests competitors' ability to do basic math, and in this case it is even easier than the sample &mdash; without any loops. <pre>^'0- &#36 1+*3*1+.</pre> #### [problem:470B] This problem uses more advanced language concepts &mdash; loop, conditional execution and even named variables! Variables are convenient to use as loop counters and result accumulators, so as to avoid stack manipulations for the same purpose. [cut] An if-then-else in FALSE looks like this: <pre>(true/false condition on top of stack) &#36; [(then statements)] ? ~ [(else statements)] ?</pre> Solution: <pre>0n: {number of 6s found uninterrupted so far} 0r: {true, if 666 found} [^&#36 1_=~] [ '6= &#36 [n; 1+ n:] ? ~ [0n:] ? n; 2 > r; | r: ] # % r; &#36 ["YES"] ? ~ ["NO"] ?</pre> #### [problem:470C] This problem can be solved in two ways. You could read numbers, store them to named variables and de...
#### [problem:470A] As usual, the first problem tests competitors' ability to do basic math, As usual, the first problem tests competitors' ability to do basic math, and in this case it is

Полный текст и комментарии »

Разбор задач Surprise Language Round 7
  • Проголосовать: нравится
  • +55
  • Проголосовать: не нравится

21.
Автор Swistakk, 12 лет назад, По-английски
IMO vs IOI Hi. Both of those great competitions for high school are upcoming, so this may be a good time to discuss about them and probably make some comparisons. Firstly, some backstory of my experiences (if you will get bored you can jump to next paragraph :P). When I was in high school I was definitely much more mathematician than algorithmist, I was doing math for my whole life but started algorithmics in high school. I considered algo as a very interesting field and devoted it much time, but math was for me more important and I was simply better at it. I took top spots in math contests when I couldn't perform well in any algorithmic contest (it was a very often case for me that I solved problem, but received very little points, because of some bugs, because in POI there was very little feedback). In my last year in high school I managed to qualify to the IMO (it would have been a tragedy for me if I wouldn't have make it) and also to the IOI, which was a big surprise for me. At IMO I did ...
much more mathematician than algorithmist, I was doing math for my whole life but started, math for my whole life but started algorithmics in high school. I considered algo as a very

Полный текст и комментарии »

Теги imo, ioi
  • Проголосовать: нравится
  • +108
  • Проголосовать: не нравится

22.
Автор dreamoon_love_AA, 12 лет назад, По-английски
If you ask me how to improve your algorithm competition skill, I will give you the link of this blog. In recent one year, I don't know why but there are many people sending messages to me for asking similar problems. So I decide to create this blog. In the beginning, I must say, you may feel disappointed after reading this blog. Because I don't have any special tips. My study method has wasted me many many time. There are some basic points I think you have known. 1. **Practice, practice, and practice.** I take so many time to think and solve problems. I think I do it 5 hours a day on average. 2. **Make friends with many awesome people.** I know many awesome people. For example, [user:arosusti,2015-02-24], [user:kelvin,2015-02-24], peter50216([user:0O0o00OO0Oo0o0Oo,2015-02-24]), [user:seanwu,2015-02-24], [user:Shik,2015-02-24], [user:takaramono,2015-02-24], [user:tmt514,2015-02-24], ... If I have some problems that I can't solve in few weeks, I can almost get solution from my friends. Then I say what I do for training myself. When I do problems. There are two possi...
me many many time. There are some basic points I think you have known. 1. **Practice, practice

Полный текст и комментарии »

  • Проголосовать: нравится
  • +516
  • Проголосовать: не нравится

23.
Автор hsk, история, 11 лет назад, По-английски
Topic wise Coding Resources So I made this listing for topic wise coding resources. It is open sourced [here](https://github.com/hkirat/awesome-competitive-coding) Thought of sharing it here too! # Awesome Competitive Coding [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) A Curated list of Topic wise Theory and Questions to Get You Started On Competitive Coding. *Inspired by the [awesome](https://github.com/sindresorhus/awesome) list thing. You might also like to read complete [awesome-list](https://github.com/sindresorhus/awesome).* ### Contributing Kindly Go Through [Contribution Guidelines](https://github.com/hkirat/awesome-competitive-coding/blob/master/CONTRIBUTING.md) First. Topics --- - Binary and Ternary Search - Dynamic Programming - Flow - Game Theory - Graphs - Greedy - Maths - Matrix Exponentiation - Miscellaneous - Prefix and Suffix Trees - Segment Trees...
- [Codechef](https://discuss.codechef.com/tags/simple-math/) — Basic

Полный текст и комментарии »

  • Проголосовать: нравится
  • +30
  • Проголосовать: не нравится

24.
Автор MohammadParsaElahimanesh, история, 16 месяцев назад, По-английски
Geometry Tricks for a 5‑Year‑Old #### Hey everyone! Geometry problems can seem a bit intimidating at first $-$ with all the floating-point errors, tricky trigonometric functions, and things like dot and cross products. But don’t worry! In this short blog, I’ll show you a simple and reliable way to handle many geometry challenges using just basic integer math. No fancy templates or advanced techniques needed $-$ just a clean, straightforward approach that makes these problems much easier to manage. #### Quick review on functions: - `area2(A,B,C)`: Twice the area of triangle ABC. Equals 0 if A, B, and C are collinear. It's the basis of other functions. - `area2(P)`: Twice the area of polygon P calculated by summing triangle areas. - `in(p,P)`: Checks if point p lies inside polygon P. Compares polygon area with the sum of triangles formed with p. - `dis2(A,B)`: Squared distance between points A and B, useful for length comparisons without the square root. - `dis(l,o)`: Distance between point o and line l. Us...
blog, I’ll show you a simple and reliable way to handle many geometry challenges using justbasic, challenges using just basic integer math. No fancy templates or advanced techniques needed $-$ just a clean

Полный текст и комментарии »

  • Проголосовать: нравится
  • +22
  • Проголосовать: не нравится

25.
Автор bashkort, 19 месяцев назад, По-английски
FAQ, Advice & AMA This post assumes you're super ambitious. But don't take any advice too seriously -- we're all different. This is simply what worked for me and might work for you. Choose your own path. #### Useful Links - [LI2 Contests](https://codeforces.me/blog/entry/131164) -- used this course when I was starting out. - [usaco.guide](usaco.guide) -- a collection of great articles & problems on almost all topics. - [OI Checklist](https://docs.google.com/spreadsheets/d/15b1ZaP1owTfTcA4vQ69A5S_wUd_vJmM8Slwu6FiWgP4/edit?usp=sharing) -- my OI Checklist. - [Pavel Mavrin's youtube channel](https://www.youtube.com/channel/UC9WDkCyUlNTncq1Y-mFSgLQ) -- watched his great lectures when I was younger :) - [qoj.ac](qoj.ac), [loj.ac](loj.ac), [dmoj.ca](dmoj.ca), [oj.uz](dmoj.ca), ... #### How do I start? **Advice:** join a great community (school, club, ...), try solving problems, and find someone who can answer your silly questions. I wouldn't have started CP if not for my school. Of c...
I was at your level: ![ ](https://i.ibb.co/6cgr2ZNn/laskjdf.jpg) #### Do you needmath

Полный текст и комментарии »

  • Проголосовать: нравится
  • +390
  • Проголосовать: не нравится

26.
Автор TahsinEnesKuru, история, 8 лет назад, По-английски
How not to perform well on Team Selection Contest x2 I read these blogs ([user:ErdemKirez,2019-05-01]'s [blog](https://codeforces.me/blog/entry/54007) , [user:matthew99,2019-05-01]'s [blog](https://codeforces.me/blog/entry/53624) and [user:I_love_Hoang_Yen,2019-05-01]'s [blog](https://codeforces.me/blog/entry/54064) ) and decided to write my story. Maybe it's becoming boring but there is no other place to share my feeling. **9th Grade** I joined the olympiad class at my school. And that year I studied math, basic C and some algorithms. Because in Turkey First round of the national contest consists of these topics. I did well on that, Probably I would be able to participate the Second round but as you know from the [user:ErdemKirez,2019-05-01]'s [blog](https://codeforces.me/blog/entry/54007) Coup d'état attempt happened and all of these rounds canceled. And also my school was closed the by government. **10th Grade** I went to another school. TUBITAK (Organizer of National Contests) did not announce for a long time for the ...
joined the olympiad class at my school. And that year I studied math, basic C and some algorithms

Полный текст и комментарии »

  • Проголосовать: нравится
  • +150
  • Проголосовать: не нравится

27.
Автор FPythonX, история, 16 месяцев назад, По-английски
Challenge: day2 Practice Smarter: 10 Codeforces Problems to Boost Your Competitive Programming Skills Contest link: [Challenge: day2](https://codeforces.me/contestInvitation/76a722ce72c61f8715a7531952347d705f5a0504) In the world of competitive programming, consistency beats intensity. You don’t need to solve 100 problems in a week — you need to solve the right problems at the right level to grow. That’s why I’ve organized 10 problems into three difficulty tiers — easy, intermediate, and advanced — so you can train smarter, not harder. Easy Level – Rating Range: 800–1200 Number of problems: 5 This range is ideal for beginners and early-stage learners. The problems here test your ability to understand problem statements, work with conditions, loops, basic math, and simple data structures like arrays or strings. These tasks may look easy, but don’t underestimate them — they lay the groundwork for everything that comes later. What to focus on: Clean implementation Under...
understand problem statements, work with conditions, loops, basic math, and simple data structures

Полный текст и комментарии »

  • Проголосовать: нравится
  • +3
  • Проголосовать: не нравится

28.
Автор kayak, история, 9 лет назад, По-английски
Some questions about Informatics Olympiad preparation Hello Codeforces, I'm new to competitive programming (that's I know basic c++ syntax and basic algorithms like what's in first half of "Algorithm Design"). I have a bit of math contest background (nothing good, I couldn't even make to national MO camp. Just saying this because I know a bit of combinatorics/number theory so I don't need to relearn the basic combinatorics again for OI). I have a few questions: 1. Are Codeforces problems good for practice? Which other judges/contests (eg: COCI) other than USACO are good for OI practice, and where I can find the judge for submission and official editorials ? For USACO, is there some places where I can read the alternative solutions to a problem rather than the ones mentioned in the official editorial? 2. While learning some C++ libraries (eg STL), should I practice implementing the features myself before learning them ? Also, which sites are good for learning the standard libraries used in OI ? I tried bunch of USACO problems, and s...
Hello Codeforces, I'm new to competitive programming (that's I know basic c++ syntax andbasic

Полный текст и комментарии »

  • Проголосовать: нравится
  • +29
  • Проголосовать: не нравится

29.
Автор Vendetta., история, 9 лет назад, По-английски
[Gym] 2017 JUST Programming Contest 4.0 — editorial ### A. Subarrays Beauty <spoiler summary="Hint 1"> Consider each bit on its own since the AND operation is bit-wise. </spoiler> <spoiler summary="Hint 2"> For each bit, notice that any sub-array that has a zero bit will add nothing to the answer. </spoiler> <spoiler summary="Hint 3"> For each bit, A sub-array of only ones of length $X$ has $\frac{X \times (X+1)}{2}$ sub-array of only ones, and each of them will add $2^{W}$ where $W$ is the Weight of the bit to the answer. </spoiler> [user:justHusam,2017-09-29] solution: https://ideone.com/PL7s1U <br/> [user:Vendetta.,2017-09-29] solution: https://ideone.com/23iukT <br/> **Complexity:** $O(N log(Max(A_i)))$. ### B. Array Reconstructing <spoiler summary="Hint 1"> You can construct the array from only one known element. </spoiler> [user:justHusam,2017-09-29] solution: https://ideone.com/IDqwCe <br/> **Complexity:** $O(N)$. ### C. Large Summation <spoiler summary="Hint 1"> All numbers are less tha...
by the factorial of half of the frequencies for each letter, basic counting math. , factorial of half of the frequencies for each letter, basic counting math.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +32
  • Проголосовать: не нравится

30.
Автор SnowLucario_Z, история, 4 года назад, По-английски
A Recap of My First Year in CodeForces Hello all on Codeforces! ------------------ It’s been just over a full year since I created my Codeforces account. Since then a lot has happened on my Codeforces journey so far. With everything that’s happened I want to look back at how I got to my current point, share what I learned in the process, recap some of my best moments, and laugh at whatever I was thinking on a few of these contests, because a lot happened. The only issue is that there’s no way I’m going to detail all **60** contests I took part in 2022. Instead I’ve chosen to “award” the 9 most memorable contests, wheter it be because I did exceedingly well or self destructed in almost hilarious fashion. A few notes before I begin: No full solutions for any problems are shown in this post but there are code snippets and discussions that are spoilers for these problems. I apologize in advance. ### First Contest &mdash; [Hello 2022](https://codeforces.me/contest/1621) This was the first contest held in 2022, ...
about 4 terms of Computer Science study at SFU, a few offhand miniprojects, a solidmath foundation, programming code](https://github.com/alxwen711/pythonCompetitiveLibrary/blob/main/algorithms/ math

Полный текст и комментарии »

  • Проголосовать: нравится
  • +71
  • Проголосовать: не нравится

31.
Автор burak, история, 5 лет назад, По-английски
A Stronger DP Solution for an Extended Version of Atcoder ABC224-F ### Introduction: [Link to the Problem](https://atcoder.jp/contests/abc224/tasks/abc224_f) **Forenote:** This is my first blog so I'm open to any feedbacks. **Forenote 2:** For anything here I am going to use 1-based indexing. Behave as if zero-based indexing does not exist :D <spoiler summary="Summary of The Original Problem"> **The problem can be summarized as follows:** There is a string $S$ of length $N$ consisting of digits $1$ to $9$. You put $+$ symbols in between some digits and you treat the terms seperated by $+$ symbols as integers and you add them. For example if $S$ is `1234` and you put $+$ symbols like in `12+3+4`, the sum you get here is 19. Consider among all possible placements of $+$ symbols. You are asked the sum of the sums of integers in every possible placement modulo $998244353$. For example if $S$ is `1234` all the different placements you can get are `1234`, `1+2+3+4`, `1+2+34`, `1+234`, `12+34`, `1+23+4`, `12+3+4`, `123+4` and their sums add u...
reading here to find the reason why you got pinged. You can read this btw, it really isbasic math!, reason why you got pinged. You can read this btw, it really is basic math!

Полный текст и комментарии »

  • Проголосовать: нравится
  • +37
  • Проголосовать: не нравится

32.
Автор k-dx, история, 4 года назад, По-английски
Tutorial: Codeforces formatting/markup # Tutorial: Codeforces formatting/markup When writing [my first blog post](https://codeforces.me/blog/entry/104172) I grew frustrated because I couldn't find resources on how to format the post and what I can/can't use. So I decided to collect what I know in this blogpost, so this wouldn't be such a problem for other newbies in the future. **This post has been written with my best knowledge. If something is incorrect please let me know!** ### Table of Contents 1. Markdown &mdash; general formatting 2. LaTeX (MathJax) &mdash; math and other special symbols 3. Codeforces specific features 4. Other useful resources 5. BONUS: Typing &#x24; in your posts ## 1. Markdown &mdash; general formatting #### Overview When you are writing a post or a comment on codeforces, you are writing in a markup language called Markdown. You can [learn more about markdown and how it works here.](https://www.markdownguide.org/) It has its own easy syntax, for example if you want **bold ...
; general formatting 2. LaTeX (MathJax) — math and other special symbols 3. Codeforces specific

Полный текст и комментарии »

  • Проголосовать: нравится
  • +119
  • Проголосовать: не нравится

33.
Автор Syrian, история, 18 месяцев назад, По-английски
Compile Time Computation? _Not sure if any blogs have been written on this recently. I found one from 10ish years ago._ Codeforces [GCC 14] compiler allows you to perform `33,554,432` operations during compile time. This is pretty small, with respect to normal time limits, but its still interesting to question whether or not it can be used to boost some solutions. Heres an attempt to cheese a CSES problem with a solution which performs large matrix multiplications: https://cses.fi/paste/1052a83da5315cb7c5d15b/ _There is an implementation of the solution mentioned above which passes CSES constraints but without compile time computations and heavily optimized._ My goal was to perform as many multiplications as possible during compilation and my results were: - **CSES:** 0 multiplications (they set a tight limit on the output file's size apparently) - **Codeforces (custom invocation):** 0 multiplication (but it let me construct and fill the base matrix) Of course, these results can be predicted...
predicted with basic math... after I was aware of the `33,554,432` limit. This is probably a bad, Of course, these results can be predicted with basic math... after I was aware of the `33,554,432

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

34.
Автор Timosh, 20 месяцев назад, По-английски
Master in a year Hello everyone! In this blog, I’d like to share my journey into Competitive Programming (CP), along with some tips and insights. Math to CP ================== Before I got into CP, I was a math Olympiad enthusiast. I participated in competitions like AMC, SEAMO, IMC, and others, achieving pretty good results—even without significant training. I think my logical thinking helped a lot. However, I never made it to the IMO. In 9th grade, during my last math Olympiad, I had a disappointing result—I scored 0/50 on the written portion, where you had to prove your solutions. Around that time, I already knew about Codeforces, but the problems seemed too difficult, and I felt it wasn’t for me that time. That’s when I decided to give Competitive Programming a serious try. Transitioning to CP wasn’t that hard, since I already had some experience with basic C++. A friend of mine, [user:C0deN1nja,2025-04-07], helped me get familiar with the platform and how the system worked. U...
), along with some tips and insights. Math to CP ================== Before I got into CP, I was a

Полный текст и комментарии »

  • Проголосовать: нравится
  • +61
  • Проголосовать: не нравится

35.
Автор _AymanSalah, история, 9 лет назад, По-английски
A new guide for newcomers in CP (Arabic and English references) If you are new to competitive programming, here's a good guide to follow that will let you master the very basic concepts of programming and math, with more than 200 problems picked carefully and sorted according to their difficulties. All problems and references are gathered in one place [**HERE**](https://docs.google.com/spreadsheets/d/12XlGl2Nae1NXRDNet_bGQ2HM2O3kq-9FS0Jm2pDwFyg/edit#gid=1683044666). There exist videos and references on each topic in the sheet (all references are in English, videos are in both Arabic and English). All references are discussed with C++. Just make a copy from the sheet to start your journey in CP. This sheet belongs to the [ACM ACPC Club Assiut University](https://www.facebook.com/acmicpc.au/). Our aim is to improve problem solving and programming skills of all students interested in participating in programming competitions or anyone wants to improve his/her algorithmic skills. Feel free to share this sheet and if you have any feedback...
the very basic concepts of programming and math, with more than 200 problems picked carefully and

Полный текст и комментарии »

  • Проголосовать: нравится
  • +58
  • Проголосовать: не нравится

36.
Автор tahmidarefin, 2 года назад, По-английски
How far can you go? Greetings to all! How far can a person go in Codeforces through _only_ improving their problem-solving skills, intuition and these following concepts for practice? - C++ Basic Syntax (Variables, Operators, Conditional Statements, Loop, Function, Recursion, Basic Pointers, Class) - Basic Math (Number Set, GCD, LCM, Factorization, Number System Conversion, Equation Solving, Basic Combinatorics, Bitwise Operation & Basic Concepts) - Basic Operations like Insert/Delete/Travers of Linear Container (i.e. Array, Stack, Queue, Linked List etc.) - Basic Searching (Linear/Binary) & Sorting of Linear Container - Standard Template Library (Vector, Set, Map, Iterator) - Basic Graph & Tree Concepts (Definition Concept & Traversing -- DFS/BFS) When I am saying the word 'Basic', it means the **minimum level** a person should learn to know about the topic, primarily. #### and the more generalized question, What are **the minimum learning requirements for each level (Pupil, Specialist,...
Pointers, Class) - Basic Math (Number Set, GCD, LCM, Factorization, Number System Conversion, , Operators, Conditional Statements, Loop, Function, Recursion, Basic Pointers, Class) -Basic Math

Полный текст и комментарии »

  • Проголосовать: нравится
  • +19
  • Проголосовать: не нравится

37.
Автор shash42, история, 9 лет назад, По-английски
ICO Preparatory Series on CodeChef As students prepare for IOI 2018 to be held in Tokyo, Japan, we present to you a contest series on CodeChef to help students prepare for their respective national selection rounds. The problems and leader board will be completely based on the IOI, with all contests having original problems related to popular concepts that the setters (who themselves are eligible for IOI-2018) have noticed in Indian selection rounds over the past years. Even though the contests are modeled after Indian rounds, they can be beneficial for aspirants from all countries. The contest will have CF Div-2 Difficulty. The best part is, subtask difficulty ranges widely, ensuring that programmers of all skill levels are engrossed for 3 intense hours. The topics that will be covered are: <ol> <li>`Clever Ad-hoc Problems (minimal Math required)` <li>`Greedy Algorithms` <li>`Sorting and Searching` <li>`Dynamic Programming` <li>`Basic Graph Algorithms` <li>`Basic Data Structures` <li>`Miscellaneous Algor...
-hoc Problems (minimal Math required)` * `Greedy Algorithms` * `Sorting and Searching` , The topics that will be covered are: * `Clever Ad-hoc Problems (minimal Math required

Полный текст и комментарии »

  • Проголосовать: нравится
  • +7
  • Проголосовать: не нравится

38.
Автор arman_ferdous, история, 10 лет назад, По-английски
Some help for the pupils You can easily tell by my rating that I am not a serious type of programmer like most of you are, but I want to become one of you guys too. I am a school boy of class 9. And I know/learnt these things- 1. I have finished learning C. I code in C++ but actually inside it is C. 2. Have some basic knowledge about C++ STL library like: queue,stack,map,string,set. 3. I know what is Dynamic Programming and CAN solve easy DP problems. 4. Also know a little bit of Graph Theory. 4. I am good at math and improving everyday. I couldn't take part in many contests before because of my exams in school. But I can most of the time (like 90%) solve problem A and B in DIV-2 Codeforces Rounds. Now I am like lost in a lot of things in this programming world, so many things, many many interesting stuff but can't understand most (it is awful). So please tell me what can be my best step from here. Should I practice at some OJ or like learn something new etc. Also I know that there are many peop...
things- 1. I have finished learning C. I code in C++ but actually inside it is C. 2. Have somebasic, 1. I have finished learning C. I code in C++ but actually inside it is C. 2. Have somebasic

Полный текст и комментарии »

  • Проголосовать: нравится
  • -12
  • Проголосовать: не нравится

39.
Автор susenyang, история, 20 месяцев назад, По-английски
Self-introduction and experience sharing after becoming a Candidate Master ### About this blog In [contest:2084], I finally reached the stage of Candidate Master. Candidate Master has a special meaning to me. May be I saw it as my official introduction to the programming competition. And now I have reached it. This blog post is about my memories and reflections on reaching CM, as well as some of my own experiences. ### My journey to CM My first codeforces round is [contest:1850], and I solved 5 problems in this round. Perhaps thanks to the experience of high school math competition (my high school math competition career was not outstanding, and finally only the provincial second prize), getting Pupil and Specialist was easy to me. I have summarized my growing up experience into the following list: - 2023/7/21 My first codeforces round [contest:1850] - 2023/8/7 Pupil - 2023/9/10 Sepcialist - 2023/10/28 Expert - 2023/10/30 Back to Specialist - 2023/12/30 Expert again - 2025/2/11 Candidate Master (roll back) - 2025/2/16 Back to Expert - ...
high school math competition (my high school math competition career was not outstanding, and finally

Полный текст и комментарии »

  • Проголосовать: нравится
  • +64
  • Проголосовать: не нравится

40.
Автор adamant, история, 19 месяцев назад, По-английски
Complex FFT is not as bad as you think ... Probably. Hi everyone! As some of you _might_ already know, I don't like NTT. Primary reasons for this are: - I don't like modular arithmetic optimizations (Montgomery, etc). - I don't like NTT mods, and prefer good, old $10^9+7$. - I do like algebra of complex numbers. But, to my regret, the overwhelming mainstream in modern competitive programming is NTT. Primary reasons are: - It's allegedly faster. - It needs less memory. - It has no precision issues. - People don't like algebra of complex numbers. There is nothing I can do about the last, but today I'll address the first 3. Optimizing complex FFT was on my mind for quite some time, but I didn't really work on it _that much_ until the [blog](https://codeforces.me/blog/entry/142063) by [user:Qwerty1232,2025-04-24] on optimizing NTT has dropped, which motivated me to actually put some serious effort into this. In this blog, we will primarily focus on optimizations that are specific to complex arithmetic...
the nearest representable number in the end. This means that the results of basic operations, such

Полный текст и комментарии »

  • Проголосовать: нравится
  • +731
  • Проголосовать: не нравится

41.
Автор Islam, история, 3 года назад, По-русски
Republic Olympiad Topics Republic Olympiad Topics for preparation ==== **====== lvl 1 | basic knowledge =====** Introductory lesson math (formulas, basic mathematic operations) if/else loop string, array asymptotics sort (bubble, merge) STL, map, set **======= lvl 2 | pre-intermediate =====** Two pointers Binary Search/Ternary Search prefix sum sliding window functions / recursion (prime) Bruteforce Greedy scan line permutation **========= lvl 3 | intermediate ===============** prime, factorization, number theory dp basic graph, dfs, bfs Sieve combinatorics modular arith Hash **========= lvl 4 | upper-intermediate ==========** fenwick tree sqrt decomposition Segment Tree Sparse Table TopSort Eulerian cycle, path Finding path algos dsu, mst bitmasks and dp bitmasks Mo's Algo digit dp DP on substring invariant, monovariant, dirichlet **======== lvl 5 | advanced ========** Cut verti...
math (formulas, basic mathematic operations)

Полный текст и комментарии »

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится

42.
Автор neitoroxin, история, 4 месяца назад, По-русски
Math in out life I don't think anyone doubts that when we solve problems on platforms like Codeforces, we are primarily sharpening our mathematical thinking, and only secondarily our algorithmic skills (such as implementation, data structures, etc.). However, lately, I’ve noticed a rather controversial trend: sometimes problemsetters don’t seem to put much effort in and just cram pure mathematics into a basic <input/output> format. You've probably encountered this in recent rounds: you open a problem, and its entire "solution" boils down to guessing a formula or a pattern just by looking at the samples. By no means am I denying the benefits of math, and I love it myself. But the context in which it is currently being served leaves much to be desired. I’m absolutely not against problems where proving a specific fact serves as the foundation for the solution (for instance, optimizing a brute-force search). Instead, I suggest adding more variety to the problems—incorporating things like "olympiad tr...
Math in out life, : sometimes problemsetters don’t seem to put much effort in and just cram pure mathematics into abasic

Полный текст и комментарии »

  • Проголосовать: нравится
  • +21
  • Проголосовать: не нравится

43.
Автор Riyad_shamiul, история, 12 месяцев назад, По-английски
Useful Algorithms Beginners Should Learn Hi everyone! I’m sharing a simple and beginner-friendly roadmap that helped me understand what to learn in the early stage of competitive programming. If you are around 800–1200 rating, this list will guide you on what to practice. 1. Basic Implementation if/else loops arrays string operations Helps with Div.3 A/B problems. 2. Simulation Problems Follow the process step-by-step Very common in 800–1000 rated tasks. 3. Sorting Built-in sort Sorting + greedy idea Many problems depend only on sort + logic. 4. Two Pointers left/right pointer sliding window Useful in array/string subarray questions (1000–1200). 5. Prefix Sum prefix sum array difference array Good for range queries. 6. Binary Search search on sorted array search on answer Extremely important as difficulty increases. 7. Basic Math GCD / LCM prime checking modular arithmetic Math appears in almost every contest. 8. Greedy Algorithms step-by-step...
7. Basic Math

Полный текст и комментарии »

  • Проголосовать: нравится
  • -19
  • Проголосовать: не нравится

44.
Автор hung8A, история, 3 года назад, По-английски
1 year of Codeforces It's been exactly one year (as of this blog) since the day I registered this Codeforces account, and also one year since the day I started cp. It's time I look back on what I have achieved as a random tryhard kid on this platform. I started this journey having known basically nothing about coding (other than basic syntaxes) and wanted to become among the very best (like tourist). At first I thought everything was easy (as I only did 800 problems), but the fact that I failed to do C in the first ever division 4 contest I had made me change my mind really quickly. From then on, it was a journey of doing contests, reading editorial, trying my best to actually understand up to C-D, learn from it, and repeat. I actually rarely do upsolving, just hanging about in the problemset finding fun and easy problems to pass the time. By now I have known some basic things like prefix/suffix sums and binary search, but never enough for me to really think that I actually deserve the Expert title...
coding (other than basic syntaxes) and wanted to become among the very best (like tourist). At first I, to pass the time. By now I have known some basic things like prefix/suffix sums and binary search

Полный текст и комментарии »

  • Проголосовать: нравится
  • +18
  • Проголосовать: не нравится

45.
Автор Nickolas, 15 лет назад, По-русски
VK Cup 2012 Wild-card Round 1: editorial So here goes the editorial. Note that Factor allows pretty random codes, feel free to put all words in one line, but all words must be separated by at least one space, don't try to skip a space between a bracket and a word or something like that. #### [problem:162A] This problem was almost the same as [problem:130A] from Befunge round. Data input and output is done exactly as in the sample code, and besides them the program needs only basic stack operations. ~~~~~ USING: io kernel math math.parser ; readln string>number dup 3 * 1 - * 2 / number>string print ~~~~~ Factor has a very system of built-in libraries which liberate the programmer from solving a lot of basic routine tasks. So after the first (trivial) probllem I gave several one-liners [cut] which needed only to find a proper library for the task. #### [problem:162B] This problem can be solved in several ways; the shortest one is to use >bin word from math.parser dictionary which does exactly what ...
code, and besides them the program needs only basic stack operations. ~~~~~ USING: io kernel

Полный текст и комментарии »

  • Проголосовать: нравится
  • +42
  • Проголосовать: не нравится

46.
Автор tee_01, история, 9 месяцев назад, По-английски
Invitation to AMS Round 1: Bridging CP and Quant Finance (Math & Expected Value) At the **Algorithms & Mathematics Society (AMS)**, we explore the space where deep algorithmic thinking meets quantitative finance. To gear up for our upcoming **AMS Official Round 1 (1st of March, 2026)**, we’ve just dropped a practice teaser problem: the Option Payoff Calculator. **The Teaser Challenge** (A &mdash; level): If you're interested in the math behind the markets, this one is for you. You're tasked with evaluating a simple call option on a stock. Given a strike price, current price, and a set of possible future price levels with their respective probabilities, can you calculate the expected payoff of the option? It's a perfect blend of expected value mathematics and implementation logic. It might sound straightforward, but structuring your logic to handle the inputs efficiently and computing the exact floating-point output is key. **Why This Matters** This problem is a classic example of applying probability to derivative pricing—a basic fundamental concept for ...
Invitation to AMS Round 1: Bridging CP and Quant Finance (Math & Expected Value), Challenge** (A — level): If you're interested in the math behind the markets, this one is for, pricing—a basic fundamental concept for anyone looking to build a strong foundation in Quant finance and

Полный текст и комментарии »

  • Проголосовать: нравится
  • +14
  • Проголосовать: не нравится

47.
Автор -Morass-, история, 9 лет назад, По-английски
Problem Topics Good Day to you! I've been asked to make some topic-wise list of problems I've solved. Even though I couldn't involve all problems, I've tried to involve at least "few" problems at each topic I thought up (I'm sorry if I forgot about something "easy"). I've alredy made such list once anyway I've tried to include more problems now &mdash; so here it is: <spoiler summary="aho"> http://www.spoj.com/problems/ADAJOBS/ URI 2226 (5) //[NICE][NUMBERS][DP] http://www.spoj.com/problems/SUB_PROB/en/ http://codeforces.me/contest/696/problem/D 8 http://www.spoj.com/problems/AHOCUR/ 5 //Aho-Corassic + DP https://www.codechef.com/problems/LYRC (5) //Sample aho-brute-force http://codeforces.me/problemset/problem/346/B //Proposed by [user:bradyawn,2019-08-03] </spoiler> <spoiler summary="automat"> 6861 [LA] //CYK UVA 10679 //Suffix Automat http://www.spoj.com/problems/STRMATCH/ //Suffix Automat &mdash; trie might do too http://www.spoj.com/problems/NSUBST...
/ViewProblem/394 (2) //Multiplication (or math) http://codeforces.me/contest/66/problem/A (2) //Big + iffs

Полный текст и комментарии »

  • Проголосовать: нравится
  • +428
  • Проголосовать: не нравится

48.
Автор Nickolas, 6 лет назад, По-английски
April Fools Day Contest 2021: editorial ##[problem:1505A] This problem described the task in quite a lot of detail. The main challenge was that it was interactive, so some effort was required to figure out the right sequence of reading from standard input, writing the answer and checking for end of file. Here is the code in Python: ```python while True: try: q = input() except EOFError: break print("no", flush=True) ``` ##[problem:1505B] As the problem statement strongly hinted, in this problem you had to calculate the **digital** root of the given number. The digital root of a given number is the (single digit) value obtained by an iterative process of summing digits, on each iteration using the result from the previous iteration to compute a digit sum. The process continues until a single-digit number is reached. ##[problem:1505C] YES or NO answer implies that you need to figure out whether the given word is a Fibonacci word. Similarly to the Fibonacci-style integer s...
] The images given encode a formula $2-x^2$ using Braille for math; the top image (the shorter

Полный текст и комментарии »

Разбор задач April Fools Day Contest 2021
  • Проголосовать: нравится
  • +140
  • Проголосовать: не нравится

49.
Автор DrSwad, 9 лет назад, По-английски
Introducing MathMash! ![ ](https://image.ibb.co/bBfvCn/logo_blue_500_transparent.png) Hello Codeforces! I'm here to announce the release of [MathMash](https://www.mathmash.org/)! It's a Math contest platform pretty similar to Codeforces in contest structure. Each user is given an initial rating of `1000` and it's updated after the end of a contest that the user participated in, based on his rank in the contest. [cut] It also has a community which I put a lot of effort into. The community is made up of mini communities: Any user can create his own forum, add admins and start a community himself. I also tried to add some facebook flavor to the site. You can make friends or follow other users. Whenever any of your friends posts or comments anything or someone upvotes your post/comment you'll get notifications. I posted about the basic functionalities of the site in this [MathMash post](https://www.mathmash.org/post.php?id=17). So today I'm hosting the [first contest](https://www.mathmas...
announce the release of [MathMash](https://www.mathmash.org/)! It's a Math contest platform

Полный текст и комментарии »

  • Проголосовать: нравится
  • +178
  • Проголосовать: не нравится

50.
Автор Hamsar, история, 7 месяцев назад, По-английски
Common Math Formulas and Tricks Used in Competitive Programming ## 1. Basic Arithmetic Formulas * Sum of first $n$ natural numbers: $$ \frac{n(n+1)}{2} $$ * Sum of squares: $$ \frac{n(n+1)(2n+1)}{6} $$ * Sum of cubes: $$ \left(\frac{n(n+1)}{2}\right)^2 $$ ## 2. Modular Arithmetic * Addition: $$ (a + b) \bmod m = (a \bmod m + b \bmod m) \bmod m $$ * Multiplication: $$ (a \times b) \bmod m = (a \bmod m \times b \bmod m) \bmod m $$ * Modular inverse (when $m$ is prime): $$ a^{-1} \equiv a^{m-2} \pmod{m} $$ ## 3. GCD and LCM $$ \text{lcm}(a, b) = \frac{a \times b}{\gcd(a, b)} $$ $$ \gcd(a, b) = \gcd(b, a \bmod b) $$ ## 4. Combinatorics $$ nCr = \frac{n!}{r!(n-r)!} $$ $$ nCr = (n-1)C(r-1) + (n-1)Cr $$ ## 5. Bit Manipulation * Power of 2 check: $$ n & (n-1) = 0 $$ * XOR properties: $$ a \oplus a = 0 $$ $$ a \oplus 0 = a $$ ## 6. Prefix Sums $$ \text{prefix}[i] = \text{prefix}[i-1] + a[i] $$ $$ \text{sum}(l, ...
Common Math Formulas and Tricks Used in Competitive Programming, ## 1. Basic Arithmetic Formulas

Полный текст и комментарии »

  • Проголосовать: нравится
  • -6
  • Проголосовать: не нравится

51.
Автор phpduke, история, 4 года назад, По-английски
Call for Contest Admin / Problemsetter! We are looking for **contest admins** and **problem setters** for a contest series we are starting at TheJobOverflow. We are experimenting with the format and variety of problems &mdash; the contests are primarily geared toward algorithms/ideas with a lesser component of peeling multilayer observations. TJO has 6,000 users and has evaluated 10,000 solution to programming tasks this week. What is TJO? TheJobOverflow is an **Open Community Platform** for interview preparation & CP. It's built and managed by alumni of IIIT Hyderabad, IIT Bombay, IIT BHU, and IIT Guwahati. Team has ICPC world finalists, IOI medalists, Math olympiad folks and also houses key people who authored math-contest [Gordian Knot](https://codeforces.me/blog/entry/57311) a few years ago ( : Our contest series is yet to be launched, meanwhile we have compiled & tested [**350 problem's Question Bank**](https://thejoboverflow.com/problems/) which includes **latest Coding Round & Interview** problems asked by **Go...
finalists, IOI medalists, Math olympiad folks and also houses key people who authoredmath-contest

Полный текст и комментарии »

  • Проголосовать: нравится
  • -13
  • Проголосовать: не нравится

52.
Автор rulerofcakes, история, 21 месяц назад, По-английски
My honest journey to Master in 4 years Hi all, this is my first blog on codeforces. I've just reached Master(+2100) after spending about 4 years on codeforces, and I'd like to talk about what I like and regret about my past decisions regarding practicing for this milestone. I know plenty of GM+s have written such blogs, but I think many of you(like my past self) may find these unrelatable simply because of how good they were from the beginning / how much time they have spent / etc, so I decided to write one of my own humble version. Hopefully some of you may find this helpful for your own journey. I honestly think it's possible to reach Master level proficiency in around 2 years, even if you're starting from scratch, assuming you practice hard enough with the right materials. This is based on my own experience. I say proficiency and not reaching the rating itself because I think having high codeforces rating may become even more meaningless in the near future with LLMs. ### The Beginning Like many of you all, I'm j...
olympiads / contests in my youth. I was terrible at math in high school, and I didn't receive any

Полный текст и комментарии »

  • Проголосовать: нравится
  • +211
  • Проголосовать: не нравится

53.
Автор lazysegtree, история, 5 лет назад, По-английски
Intution behind simple solution of this problem. The problem is "What is the number of recursive palindromic binary strings of length n ? " A string "s" of length n is recursively palindromic is "s" is a palindrome and the first half of "s", is also recursively palindrome. Example of recursively palindromic strings : 0001000 1011101 111 For example for n = 5, there are four such strings {00000, 00100, 11011, 11111}, so answer is 4. What I came up with is : T1 = T2 = 2 (n is odd) Tn = 2*T((n-1)/2) (n is even) Tn = T(n/2) Interestingly . It turns out that Tn = 2^(no. of set bits in binary representation of n) . Can someone explain an intuition behind this simple answer, and how can one come up with this solution ? Reference : https://discuss.codechef.com/t/official-basic-math-combinatorics-problems/65236/16
Reference : https://discuss.codechef.com/t/official-basic-math -combinatorics-problems/65236/16

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

54.
Автор techgodprogrammer, история, 5 месяцев назад, По-английски
Stuck After 145 Problems? How a Rubber Duck Saved My CP Journey Hey Codeforces! Like a lot of beginners out there (especially younger coders like me, I'm 12), I recently hit a massive brick wall. I was grinding hard and slammed through about 145 problems—mostly the usual 800 to 1000 rated stuff. I thought I was absolutely cracked and ready to carry. But nope. Every single time a live contest kicked off, my brain would literally Ctrl+Alt+Del. I completely froze up on Div. 2 B and Div. 3 C. I was hard-stuck at a 900 rating and it was driving me crazy. I had the daily grind down, but the second that contest timer started ticking, panic mode activated. I realized I was spending way too much time blindly typing out code, hoping for a lucky "Accepted," instead of actually teaching my brain how to break down the logic. So, I threw my old routine out the window and tried something totally different. I picked up two super simple, non-coding tricks that completely saved my sanity. If you are stuck in the "Grey/Green zone" even though you are practicing t...
Use code with caution. Why it works: Trying to figure out the math puzzle while worrying about C, math puzzle while worrying about C++ syntax, fast I/O, and vector limits completely fries your brain

Полный текст и комментарии »

  • Проголосовать: нравится
  • -16
  • Проголосовать: не нравится

55.
Автор errorgorn, 5 лет назад, По-английски
On Div2ABs 2 years ago, [user:antontrygubO_o,2022-04-27] wrote [a blog](https://codeforces.me/blog/entry/75163) about div2ABs where he expressed his opinions that d2ABs should not be about "here is a statement, please implement what is written there". Thanks to him, the quality of d2ABs (and problem quality in general) have certainly improved. However, I still believe that there still quite large differences between how coordinators/problemsetters view d2ABs and how the intended participants view them. From the survey made by [user:kpw29,2022-04-27], we can see that most people agree that most people agree that we should **primarily** consider the target audience when proposing a task. I too think if a task is boring to div 1 contestants, we should not think of that as a reason to immediately disqualify a problem from being a d2A. ![ ](https://codeforces.me/predownloaded/70/b5/70b515da85a4dc3b362cf4eb0963dbd1fb642819.png) I think when people judge the interesting-ness of d2As, they try...
statement? Imagine you are a beginner in competitive programming and you only know somebasic

Полный текст и комментарии »

  • Проголосовать: нравится
  • +330
  • Проголосовать: не нравится

56.
Автор imshrey_0006, история, 7 месяцев назад, По-английски
How to Increase Codeforces Rating (Practical Tips) Hello everyone, I wanted to share some practical tips that can help in improving Codeforces rating. These are simple things that worked for me and many others. 1. Focus on solving A and B problems quickly In most contests, your rating depends a lot on how fast and accurately you solve the first 2–3 problems. 2. Learn common patterns Many problems are based on patterns like two pointers, greedy, prefix sums, and basic math. Recognizing patterns saves time. 3. Practice regularly Consistency is more important than solving many problems at once. Even 2–3 problems daily can help. 4. Upsolve after contests After every contest, try to solve the problems you couldn’t solve. This is one of the fastest ways to improve. 5. Debug your mistakes Instead of immediately checking the solution, try to understand where your logic went wrong. 6. Don’t panic during contests Stay calm. Even if you get stuck, move to the next problem and come back later. 7. Improve i...
pointers, greedy, prefix sums, and basic math. Recognizing patterns saves time. 3. Practice, sums, and basic math. Recognizing patterns saves time.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -22
  • Проголосовать: не нравится

57.
Автор SpS__79, история, 20 месяцев назад, По-английски
Tips for python beginners to solve Codeforces Problems. 1. **Fast I/O** — Python's default input() is too slow for massive test cases. You can override it with sys.stdin.readline to prevent Time Limit Exceeded (TLE) errors. *import sys* *input = sys.stdin.readline* 2. **Map function** — While taking an integer array input in python we can easily take it through the map function and using the code mentioned below we can directly change it into a list. *var = list(map(int,input().split()))* *n, k = map(int, input().split())* 3. **Max-Min-Sum function** — To get the maximum, minimum, or total sum value from a list without writing manual loops. *val = max(var)* *total = sum(var)* 4. **Sort** — For sorting an array [Remember the sort() method doesn't return the sorted list. Rather it sorts the list in place and returns None. Therefore, assigning var.sort() in a variable will make it equal to None]. *var.sort()* *print(var)* 5. **List Comprehension** — You can directly perform loops inside a list to initialize arrays in one clean line...
functions for basic math. Python has highly optimized built-in functions for GCD, LCM, ceilings, and

Полный текст и комментарии »

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

58.
Автор -is-this-fft-, история, 5 лет назад, По-английски
[Tutorial] The command line: how to read input from file without #ifdef and much more #### Introduction Instead of algorithms and math, I'll be doing something completely different here. There is something that has bothered me for a long time: people not understanding the tools they use to participate in contests and thus failing to take real advantage of them. And it all goes back to not understanding the command line. Some of you might say, "well surely, the command line is something obsolete and you're only clinging to it because you [insert ridiculous amateur-psychology here]?" No! The command line is not obsolete, and unless competitive programming becomes so mainstream that software vendors start writing professional-grade tools aimed specifically at us, it won't be. [cut] $~$ What is the command line? Any of these: ![ ](/predownloaded/bd/b6/bdb6c157b9b3ce5ae046c9064e469e0081f8c0fe.png) As you can see, it comes in many background colors and fonts, but the basic idea is always the same. It's a box you can type commands in, which it will ...
#### Introduction Instead of algorithms and math, I'll be doing something completely different

Полный текст и комментарии »

  • Проголосовать: нравится
  • +443
  • Проголосовать: не нравится

59.
Автор 3.14159265359, история, 4 года назад, По-английски
Math Math Math Hello everyone, I wonder if working on Project Euler will help us to be good at math and thinking in competitive programming. I admire the Chinese people because they are very good at math and I want to be too. And I find that most people who are good at Math are usually quite easy to get high rank in Codefoces competitions, that's my personal opinion. And let me ask if there is a contest for us to practice Math from basic to advanced in programming and people's reviews about the Project Euler website. Thanks.
Math Math Math, to practice Math from basic to advanced in programming and people's reviews about the Project Euler

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

60.
Автор rubikscode, история, 6 месяцев назад, По-английски
Divisibility Rules (Basic Math) Blog #1 Divisibility Rules for different divisors ================== For Divisor = 1 ------------------ There is no specific condition. Every number is divisible by 1. For Divisor = 2 ------------------ If the last digit of the number is even, then that number is divisible by 2. For example, 0, 2, 4, 6, 8. For Divisor = 3 ------------------ - The sum of the digits is divisible by 3, then that number is also divisible by 3. - Subtract the quantity of the digits 2, 5 & 8 from the quantity of the digits 1, 4, & 7. If this difference is divisible by 3, then that number is also divisible by 3. _For Example, 16,499,205,854,376 has four of the digits 1, 4 and 7 and four of the digits 2, 5 and 8; since 4 − 4 = 0 is a multiple of 3, the number 16,499,205,854,376 is divisible by 3._ - Subtracting the last digit of the number twice from the rest of the number. If this difference is divisible by 3, then that number is also divisible by 3. _ For Example, 405: 40 − 5 × 2 = 40 − 10 = ...
Divisibility Rules (Basic Math) Blog #1

Полный текст и комментарии »

  • Проголосовать: нравится
  • -6
  • Проголосовать: не нравится

61.
Автор justnemat, история, 14 месяцев назад, По-английски
Should I Focus on Projects or Aim for a CCO Medal? Lately, I’ve been asking myself a big question: what’s the best path to stand out for admission into top universities in Canada and the U.S.? Should I invest my time into creating a few meaningful projects, or should I give my absolute best to earn a medal at the Canadian Computing Olympiad (CCO)? Option 1: Build 3 Projects Here are the three projects I’m considering: 1. Competitive Programming Tracker – A web app that tracks coding contest progress, offering analytics and recommendations for improvement. 2. QuantSim – A simulation tool for basic trading strategies, designed for students curious about quantitative finance. 3. Euclid Puzzle Generator – A platform that generates math competition–style problems with step-by-step solutions. Option 2: Aim for a CCO Medal On the other hand, winning a medal at the CCO is one of the strongest signals of programming ability in Canada. It’s highly respected by top universities like Waterloo, MIT, and U of T. A medal could demon...
recommendations for improvement. 2. QuantSim – A simulation tool for basic trading strategies, designed for, . QuantSim – A simulation tool for basic trading strategies, designed for students curious about quantitative

Полный текст и комментарии »

  • Проголосовать: нравится
  • -18
  • Проголосовать: не нравится

62.
Автор M0rdy, история, 3 года назад, По-английски
Welcome To The Masters Of Cheating hello, codeforces and [user:MikeMirzayanov,2023-07-24] and all people that solve problems without cheating. I would to know why this type of cheating can not be skipped or even banned in the last Div 4 [contest:1850] I saw a lot of people cheat in an ugly way you can see some of them here [submission:214899709] [submission:214868771] [submission:214860063] [submission:214918340] [submission:214911596] [submission:214907210] [submission:214878598] "can not solve a basic Binary Search Problem and basic math XD" why there is no effective way to report this submission and this user? they reach Blue Or Even Red in this way when I see someone reach Blue in 4 or 5 months and I am stuck in green for more than 1 year I will be sad and leave CP hope this blog reach to someone who can help us with this problem and there is an image of them while cheating: ![ ](/predownloaded/bb/6d/bb6d815319aad9b88d8ac418e241a721bdb5d65b.jpg) update 1: this one solved all contest with chea...
Problem and basic math XD" why there is no effective way to report this submission and this user

Полный текст и комментарии »

  • Проголосовать: нравится
  • +15
  • Проголосовать: не нравится

63.
Автор rubikscode, история, 6 месяцев назад, По-английски
Divisibility Rules (Basic Math) Blog #1 Divisibility Rules for different divisors ================== For Divisor = 1 ------------------ There is no specific condition. Every number is divisible by 1. For Divisor = 2 ------------------ If the last digit of the number is even, then that number is divisible by 2. For example, 0, 2, 4, 6, 8. For Divisor = 3 ------------------ - The sum of the digits is divisible by 3, then that number is also divisible by 3. - Subtract the quantity of the digits 2, 5 & 8 from the quantity of the digits 1, 4, & 7. If this difference is divisible by 3, then that number is also divisible by 3. _For Example, 16,499,205,854,376 has four of the digits 1, 4 and 7 and four of the digits 2, 5 and 8; since 4 − 4 = 0 is a multiple of 3, the number 16,499,205,854,376 is divisible by 3._ - Subtracting the last digit of the number twice from the rest of the number. If this difference is divisible by 3, then that number is also divisible by 3. _ For Example, 405: 40 − 5 × 2 = 40 − 10 = ...
Divisibility Rules (Basic Math) Blog #1

Полный текст и комментарии »

  • Проголосовать: нравится
  • -24
  • Проголосовать: не нравится

64.
Автор Coderhype, история, 21 месяц назад, По-английски
7 Types of Codeforces Users Salam Codeforces! Salam Codeforces! Salam Codeforces! Today I will tell you 7 types of coders. ### The "I'll Upsolve Later" Joins contests, reads problem A, nods wisely, then disappears. "I’ll solve it later." (No, he won’t.) ### The Debugging Monk Writes code in 5 mins, spends 90 mins debugging, adds 27 cout statements, still WA. "Codeforces is broken." (No, your logic is.) ### The Math God Solves problem D using a formula no one understands. Thinks segment trees are too basic. Probably discovered a new theorem mid-contest. ### The Python Wizard Writes a 3-line solution that gets TLE on test 2. "Codeforces is biased against Python users!" (Or maybe input() is just slow.) ### The Grandmaster Solves E before you finish reading problem A. Uses one-letter variable names but writes cleaner code than your CS professor. Might be a bot. ### The Memelord Never competes, just comments “bruh” on blogs. Owns a shrine of tourist’s submissions. "Rat...
.) ### The Math God Solves problem D using a formula no one understands. Thinks segment trees

Полный текст и комментарии »

  • Проголосовать: нравится
  • +90
  • Проголосовать: не нравится

65.
Автор MinakoKojima, 14 лет назад, По-английски
Codeforces Round #172 Editorial Overview ... ================== In DIV 1, there are 3 normal tasks accompanied with 2 challenge tasks. About 40 competitors solve first three tasks during the contest and I believe there will be more if we extended the duration a little bit. Task D is a standard data-structure problem hidden behind a classical maximum cost flow model. This kind of problem are usually trick-less, but hard to implement especially under the pressure. Because of this, it becomes tonight's draw-breaker. Task E is a extended version on a classical DP && Math problem. There are many solutions to the original problem, one is giving a global view under the state transition, and using a data structure to handle it carefully. However, this one is even more harder, few people have ever tried it except [user:Jacob,2013-03-11]. (Although is wrong.) As a seasoned competitor, [user:Petr,2013-03-10] took the C-B-A order which proved to be the best choice through out the night. And after quickly solved C and...
. Task E is a extended version on a classical DP && Math problem. There are many solutions to the

Полный текст и комментарии »

Разбор задач Codeforces Round 172 (Div. 1)
Разбор задач Codeforces Round 172 (Div. 2)
  • Проголосовать: нравится
  • +138
  • Проголосовать: не нравится

66.
Автор gvikei, 16 лет назад, По-английски
Basic Binary Indexed Tree (English version) <p class="MsoNormal" align="right" style="text-align: left;margin-bottom: 0.0001pt; line-height: normal; "><font class="Apple-style-span" face="'Times New Roman', serif" size="5"><span class="Apple-style-span" style="font-size: 18px;"><i></i></span></font></p><font class="Apple-style-span" face="'Times New Roman', serif" size="5"><i><p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt; text-align:right;line-height:normal"><font class="Apple-style-span" size="4"><span class="Apple-style-span" style="font-size: 16px;"></span></font></p><font class="Apple-style-span" size="4"><p class="MsoNormal" align="right" style="margin-bottom:0cm;margin-bottom:.0001pt; text-align:right;line-height:normal"></p><p class="MsoNormal" style="text-align: justify;margin-bottom: 0.0001pt; line-height: normal; "><span lang="EN-US" style="font-size:12.0pt;font-family:&quot;Times New Roman&quot;,&quot;serif&quot;; mso-fareast-font-family:&quot;Times New Roman&quot;;color:black;ms...
Basic Binary Indexed Tree (English version), ] (or Get , ="font-size:12.0pt; font-family:"Cambria Math","serif";mso-fareast-font-family:"

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

67.
Автор alexlikemath007, 4 года назад, По-английски
A proper tutorial for one of the craziest 3D-geometry problems Warning: This problem is like the warden of competitive programming. It is a force of nature &mdash; like a hurricane, and when you see a hurricane you don't fight it, you run. It is a big bad boss with a bunch of hitpoints, and deals big damage to your sanity. But when you kill it, it doesn't drop much loot, experience, or educational value compared to other problems. It would be wiser to go and solve some problems and learn how to use binary search. The problem: https://codeforces.me/gym/102452/problem/F It's tutorial says: Since n is small, $O(n^2)$ simulation is OK. Advanced 3-D geometry methods are highly required. The tutorial doesn't describe what the advanced 3-D geometry methods are. So, I have written this blog to remedy that gap. <spoiler summary="Chapter 1. Prologue"> You should create a `point` struct this makes things a bit easier. It has an `double x`, `double y`, `double z` coordinate. This point will be immensely useful, as we can define a line segment...
sphere as a center + a radius. The point is the most basic unit in geometry, and it is a good idea

Полный текст и комментарии »

  • Проголосовать: нравится
  • +434
  • Проголосовать: не нравится

68.
Автор lnishan, 11 лет назад, По-английски
An awesome list for competitive programming! This is a project I started from late January 2016. My motive is that: Although there's fantastic information out there, I think they're still spread all over the place. Therefore, in my opinion it would probably be cool if there's an [awesome list](https://github.com/sindresorhus/awesome) for competitive programming! ( *It's now featured on the main list!* ) I'm actively updating the list here: [https://github.com/lnishan/awesome-competitive-programming](https://github.com/lnishan/awesome-competitive-programming) # Awesome Competitive Programming [![Awesome](https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg)](https://github.com/sindresorhus/awesome) A curated list of awesome `Competitive Programming`, `Algorithm` and `Data Structure` resources. Created with a view to connecting people to information, this list below contains a complete collection of all the fantastic resources I've collected over the course of my 11...
tutorials on basic algorithms and data structures. | | ★★☆ | [Competitive Programming &mdash

Полный текст и комментарии »

  • Проголосовать: нравится
  • +438
  • Проголосовать: не нравится

69.
Автор Jajceslav, история, 12 месяцев назад, По-английски
How to sort a Graph? Hello Everyone! =============== Recently, me and [user:DjeniUp,2025-12-17] started a YouTube channel, dedicated to algorithms, math and competetive programming in general. Today we released a new video on a topic of Topological Sort! ![ ](/predownloaded/e6/ef/e6ef7688077d2a87c6a9ad54e3f4ecb54aa71add.png) Link: https://www.youtube.com/watch?v=EJoKJiod0KQ Feel free to leave your suggestions in the comments under the video or this blog! We would like to explore more competetive programming topics, from basic to complicated ones Here's the link to the whiteboard that you see in the video: https://miro.com/app/board/uXjVGcpqFXU=/ All codes can be found there or on our github: https://github.com/Lincatoria/VideoMaterials
channel, dedicated to algorithms, math and competetive programming in general. Today we released a

Полный текст и комментарии »

  • Проголосовать: нравится
  • +62
  • Проголосовать: не нравится

70.
Автор kazama460, история, 8 лет назад, По-английски
Need help in Modular Arithmetic (Simple Problem) i am stuck at simple problem , and the problem is that there is no Editorial available for this problem. The problem is as follows: Given M (Distinct) integers A1 , A2 , A3 , A4 , A5 ...... , Am , find all integers K , such that remainder of all elements with k is same I.E. A1%K = A2%K = A3%K = ..... = Am%K and K>1. Number of elements are 100 , and Ai <= 10^9 My solution is brute force: i am running a loop from 2 to second largest element (which can be upto 10^9) and finding all k , but its giving TLE. [This is the link to the problem](https://www.hackerearth.com/practice/math/number-theory/basic-number-theory-1/practice-problems/algorithm/a-simple-task/description/) any hint or help would be appreciative. Thanks in advance and happy coding.
/math/number-theory/basic -number-theory-1/practice-problems/algorithm/a-simple-task/description, [This is the link to the problem](https://www.hackerearth.com/practice/math /number-theory/basic

Полный текст и комментарии »

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

71.
Автор strawberryshaker2005, 6 лет назад, По-английски
[Help a n00b] I am not able to do even Div 3 B :( **Warning: Long sad problem below :(** **A bit of background about me:** I am a 10th grade student from India preparing for IOI... Hello, my fellow coders, I had a question in my mind. I know basic C++ STL, math (that's probably it!). I regularly take part in contests for 2 months as I have started CP 2 months back. Earlier I was able to do A and B in a Div 2 contest regularly. But now as I am giving more and more contests and trying to improve my skill-set and problem ratings, I am seeing a decline in my performance. I am not able to think of solutions to the problems. If I am able to think of them, I am sometimes not able to implement them... I desperately want to improve myself. I feel very very demotivated every passing day... I know my questions are frustrating just like any other beginner but please bear with me. I practice every day for 2 hrs approximately. I am doing A ladder currently from this website (suggested by another great coder): [https://codedigger.tech](h...
know basic C++ STL, math (that's probably it!). I regularly take part in contests for 2 months as I, I had a question in my mind. I know basic C++ STL, math (that's probably it!). I regularly take

Полный текст и комментарии »

  • Проголосовать: нравится
  • +9
  • Проголосовать: не нравится

72.
Автор Cappybara, история, 2 месяца назад, По-английски
I built a tool to help track ICPC prep and Codeforces progress Hey Codeforces! Preparing for ICPC can be pretty overwhelming. Whether you're just trying to pass your regionals or aiming for the World Finals, it's hard to keep track of what you actually need to study, what your weak topics are, and how much progress you're making over time. I wanted something to make the grind a little more structured, so I built a side project called ICPC Prep Hub. I’ve been working on it for a while and wanted to share it with you all today. It’s completely free and open-source. To make it super easy to use, there are no passwords to remember—you just verify your CF handle once, and it saves your progress across all your devices. What does it actually do? CF Analytics & Recommendations: The site syncs your solved problems straight from Codeforces. You can see your rating graph, check your accuracy, topic wise rating, and compare the problem tags you solve (like DP vs. Math) against other real users or the top N users. This makes it really easy to see...
solve (like DP vs. Math) against other real users or the top N users. This makes it really easy to

Полный текст и комментарии »

  • Проголосовать: нравится
  • +2
  • Проголосовать: не нравится

73.
Автор ko_osaga, история, 4 года назад, По-английски
[Tutorial] On Range LIS Queries, Part 1 Hello, Codeforces! At some point of life you want to make a new data structure problem with short statement and genius solution. LIS (Longest Increasing Subsequence) is a classic problem with beautiful solution, so you come up with the following problem: * Given a sequence $A$ of length $N$ and Q queries $1 \le i \le j \le N$, compute the length of Longest Increasing Subsequence of $A[i], A[i + 1], \ldots, A[j]$. But on the other hand this looks impossible to solve, and you just give up the idea. I always thought that the above problem is unsolved (and might be impossible), but very recently I learned that such queries are **solvable** in only $O(N \log^2 N + Q \log N)$ time, not involving any sqrts! The [original paper](https://arxiv.org/abs/0707.3619) describes this technique as *semi-local string comparison*. The paper is incredibly long and uses tons of scary math terminology, but I think I found a relatively easier way to describe this technique, which I will show in t...
technique as *semi-local string comparison*. The paper is incredibly long and uses tons of scarymath

Полный текст и комментарии »

  • Проголосовать: нравится
  • +372
  • Проголосовать: не нравится

74.
Автор myst-6, история, 3 года назад, По-английски
My Story, Thoughts and Motivation Hello Codeforces! Over the weekend I attended the British Informatics Olympiad final. Today I'd like to share my CP journey so far, some thoughts on how it was, and my plans going forward. I started programming in general when I was 12; I learned JavaScript from an old book that was lying around in my house and wrote some small websites &mdash; as a lot do when starting out &mdash; and generally dabbled in whatever interested me. Through the COVID lockdown I played multiplayer video games with some school friends such as Minecraft, and played various JRPGs with my sister such as Tales of Symphonia. I took a hiatus from programming but towards the end of the lockdown and as in-person school began to start, I decided to pick it back up again. In April of 2021, I signed up to [Codewars](https://www.codewars.com/users/myst-6). I wouldn't describe this website as a competitive programming &mdash; problems feel less math-y and (usually) don't require complex algorithms but instead f...
programming — problems feel less math-y and (usually) don't require complex algorithms but instead

Полный текст и комментарии »

  • Проголосовать: нравится
  • +274
  • Проголосовать: не нравится

75.
Автор Nickolas, 12 лет назад, По-русски
VK Cup 2015 Wild Card Round 1: editorial In this contest we aimed to show that declarative approach to problemsolving can be more convenient than the traditional imperative. However, the first several problems were supposed to aquaint the competitor with the basic language syntax and its libraries. All reference solutions are written by [user:kit1980,2015-03-28]. #### [problem:530A] To solve a quadratic equation, one has to use a library function `sqrt` and an if-then-else construct. Besides, this problem was supposed to show that Picat has foating-point numbers. :-) ~~~ main => A = read_real(), B = read_real(), C = read_real(), D = B * B - 4 * A * C, X1 = (-B - sqrt(D)) / (2 * A), X2 = (-B + sqrt(D)) / (2 * A), if D == 0 then println(X1) else printf("%w %w%n", min(X1, X2), max(X1, X2)) end. ~~~ #### [problem:530B] A string manipulation problem: library function `slice` allows to get a substring of the given string, `reverse`, well, reverses it, and `++` is...
competitor with the basic language syntax and its libraries. All reference solutions are written by

Полный текст и комментарии »

  • Проголосовать: нравится
  • +45
  • Проголосовать: не нравится

76.
Автор _notpalindrome_, история, 7 лет назад, По-английски
Maths in CP Can anyone tell me actually whats types of MATH knowledge needs in competitive programming from very basic not advance please. My math knowledge is actually very very low like you can assume I just can add, sub, multiply, and division. I am very depressed about it because when I failed to solved a problem and see its tag name like CF(C,D) "math" or math/sorting/ or something related to math etc. Recently I made a plan that I spend at least 2 hours or above hours for learning math everyday. So some experienced person please suggest me a book or tuitorial or link where I can learn the basic math concepts thats need in competitive programming. Thanks a lot for read the long story. :) Sorry for my poor english.
very basic not advance please. My math knowledge is actually very very low like you can assume I just

Полный текст и комментарии »

  • Проголосовать: нравится
  • +19
  • Проголосовать: не нравится

77.
Автор Endagorion, история, 9 лет назад, перевод, По-русски
Yandex.Algorithm 2017, third elimination round: editorial (with challenges, bells and whistles) This time I've decided to play with spoilers to faciliate the presentation as some of the guys here did before. Tell me what you think about this write-up! #### Problem A. Shifts Topics: dynamic programming. Summary: the first "hard" problem of the contest. Knowing your basic DP problems helps a lot, but coming up with the precisely correct solution may take a lot of persistence. Solution: Suppose that we are allowed to make left circular shifts as well as right ones. <spoiler summary="Can you solve the problem in this case?"> First of all, making a shift is effectively moving a character to a different position in the string. Clearly, moving a character more than once makes no sense since we could have just moved it to its final destination instead without wasting any operations. Also, it obvious that the number of occurences of each character should be the same in both strings since it is preserved by shifts. Now, consider the characters that are *not* moved by ...
: dynamic programming. Summary: the first "hard" problem of the contest. Knowing yourbasic DP problems

Полный текст и комментарии »

  • Проголосовать: нравится
  • +255
  • Проголосовать: не нравится

78.
Автор nhanzzzz, история, 5 месяцев назад, По-английски
ZetaCP — An All-in-One IDE desgin for Competitive Programming Hi Codeforces! I'd like to share ZetaCP, a desktop app I've been building to solve a problem most of us deal with every contest: too much context switching between the editor, the judge, testcase files, stress testers, and a dozen small tools scattered across different windows. ZetaCP brings all of that into a single, tightly integrated workspace, so your editor, tester, and problem tools actually stay in sync with each other. It's built on Tauri v2 (React + TypeScript frontend, Rust backend), which means it's lightweight, starts fast, and runs as a portable app with no extra setup required. GitHub: https://github.com/nhanzzzzreal/ZetaCP What's inside CP Calculator — primality checks, prime factorization, bitmask operations, arithmetic tools, base conversion, plus support for bigint and high-precision decimal math. Testcase Manager — import/export testcases directly from a folder, manage them all in one place, organize subtasks, configure time/memory limits, and work ...
for bigint and high-precision decimal math. Testcase Manager — import/export testcases directly

Полный текст и комментарии »

Теги ide
  • Проголосовать: нравится
  • +12
  • Проголосовать: не нравится

79.
Автор Arpa, история, 4 года назад, По-английски
Ten years of competitive programming 3 Hey Codeforces! I’m AmirReza PourAkhavan, the former Codeforces Contest Coordinator. I let the story become complete and I’m sharing it now. The story is about a 16-year competitive programmer, who left his family and migrated to another city alone to follow competitive programming. After seven years, he advanced to the International Collegiate Programming Contest World Finals, twice. Read the previous post [here](https://codeforces.me/blog/entry/108838). **Read the Persian version** [**here**](https://docs.google.com/document/d/e/2PACX-1vSUoFC9tLgDCji6rSCYy-RYoUG1_6uOQnHz_LlLKe6KksWBYWO4r6clDly5YxIgzu1g3Tj31weDxgWz/pub). What happened previously === I was a lone programmer, in a small city, trying to learn CP and prepare for the Iran national olympiad. It was not as successful as I expected. I tried to change my school and I migrated to Tehran, alone. I entered AE high school to learn from its inspiring teachers. 11th grade === First day of school. I got to ...
two free days, two days of normal lessons (Math, Physics, …), and three days of classes especially for

Полный текст и комментарии »

  • Проголосовать: нравится
  • +179
  • Проголосовать: не нравится

80.
Автор cbdb, история, 2 года назад, По-английски
How to get better at "BASIC" Math? (Ft. Round 986 B) Hi everyone, Today's codeforces round involved finding the number of occurrences of a certain AP in a range, for example 1,3,5,7... in a range of 0 to 99. A lot of users have solved the problem with: if((n-1)<c) return 0; return (n-1-c)/b + 1; Although such one liners seem simple, basic maths, they are tricky and error prone to come up with during contests, with even some higher rated coders making mistakes in the same. How can I improve this aspect of my maths? Thanks for your time. PS: I still don't know why this formula works. Any further problems requiring similar ideas would be appreciated.
How to get better at "BASIC" Math? (Ft. Round 986 B), seem simple, basic maths, they are tricky and error prone to come up with during contests, with even, Although such one liners seem simple, basic maths, they are tricky and error prone to come up with

Полный текст и комментарии »

  • Проголосовать: нравится
  • +7
  • Проголосовать: не нравится

81.
Автор sompurok, история, 12 месяцев назад, По-английски
The Shortest & Most Effective Topic List for Codeforces Beginners Want to climb rating fast? Here’s the simplest 10-topic roadmap that actually works: - Basic Programming (Fast I/O, loops, vectors, strings) - Greedy - Binary Search - Two Pointers - Sorting + Simple Math (GCD, modulo) - Prefix Sums / Difference Arrays - Basic 1D DP - Graphs – BFS + DFS - Number Theory (Sieve, primes, modular inverse) - Basic Data Structures (Stack, Queue, Set, Map, Priority Queue) Fastest Practice Plan: - 1 topic per week - Solve only 800–1200 rated problems - Focus on Div.2 A → B → C (then D) Start here: https://codeforces.me/problemset?tags=800-1200&order=problem_rating_ASC Follow this and you can go Newbie → Pupil → Specialist → Expert in just 3–6 months!
+ Simple Math (GCD, modulo) - Prefix Sums / Difference Arrays - Basic 1D DP - Graphs – BFS + DFS, - Sorting + Simple Math (GCD, modulo) - Prefix Sums / Difference Arrays - Basic 1D DP - Graphs

Полный текст и комментарии »

  • Проголосовать: нравится
  • -32
  • Проголосовать: не нравится

82.
Автор Cuber-26, история, 15 месяцев назад, По-английски
Could anyone give me some suggestions in learning please? Hello everyone, I'm [user:Cuber-26,2025-08-30]. Two years ago I don't even know how to write a program in programming language like C++. I started to learn programming and some very basic algorithms when I was a Freshman. Now it has been a year since I first come to Codeforces, currently my contest rating is $1815$. Since I'm actually a student learning Mathematics, the part I do the best is Number Theory. I'm also good at solving some constructive problems and math problems. Problems like interactive or bitmask are OK for me too. However some parts are my shortcomings: 1. Data Structures: Now I only learned BIT, Segment Tree, DSU, Trie, Sparse Table, and could only accomplish some simple applications. 2. Graphs(especially problems related to paths): I've never finished any problem about shortest paths and weighted graphs. I've learned Dijkstra and Floyd in Data Structure Course. However I had never written them into code, and I've completely forget them after final ex...
program in programming language like C++. I started to learn programming and some verybasic

Полный текст и комментарии »

  • Проголосовать: нравится
  • +33
  • Проголосовать: не нравится

83.
Автор Asakire, история, 11 месяцев назад, По-английски
Modulo and Integer arithmetic Recently i went through few modulo and integer arithmetic section from a website I am writing this as recap for myself but it might help beginners who are unfamiliar with Modular arithmetic A few basic observations ======================== If a mod b = 0, then a is divisible by b. This single condition appears in an enormous number of problems, from basic number theory to constraints checking. Another common use is determining parity. `If n mod 2 = 0, the number is even`; `if n mod 2 = 1, it is odd`. Whenever a problem involves alternating behavior, parity, or splitting elements into two groups, modulo 2 is usually the first thing worth checking. Modulo and cyclic behavior ========================== One important property of modulo is that it naturally creates cycles. The values of n mod 5, for instance, repeat as `0, 1, 2, 3, 4, 0, 1, 2, 3, 4, ....` This is extremely useful in practice. Circular arrays, rotating turns, and repeating patterns can all be handl...
A few basic observations ======================== If a mod b = 0, then a is divisible by b. This

Полный текст и комментарии »

  • Проголосовать: нравится
  • -2
  • Проголосовать: не нравится

84.
Автор repeating, история, 10 лет назад, По-английски
Help with geometry and math problems ... Hello guys . I have an issue in dealing with problemes which depend on geometry and math . can you help by give me books or any thing which includes the basic mathematical laws that can help me in math and geometry problems . :D :D :D Thanks for advice
Help with geometry and math problems ..., Hello guys . I have an issue in dealing with problemes which depend on geometry andmath . can

Полный текст и комментарии »

  • Проголосовать: нравится
  • +11
  • Проголосовать: не нравится

85.
Автор Wanderkind, история, 2 года назад, По-английски
Automating reduction on algebraic expressions I recently stumbled upon a problem from Stanford Local ACM Programming Contest (SLPC) 2011. <br> [(contest info)](https://cs.stanford.edu/group/acm/oldsite/SLPC2011/) <br> [(try the problem yourself here)](https://www.acmicpc.net/problem/7636) <br> So the problem is, in short, given algebraic expressions of trigonometry like $x(sin^2x + cos^2x) − x$, you have to determine whether each expression equates to zero. <br> The intended solution, I am assuming, is to <br> 1) convert the input string into a function of $x$ that returns the value, under the same process the expression is described, <br> 2) input multiple values of $x$ into that function, and <br> 3) confirm the identity if the function always returns zero &mdash; within the bounds of float precision error. <br> Unaware of this idea, I initially tried to solve this problem by building a recursive reduction algorithm. <br> Using the F# language, I made a custom algebraic data type, with a set of rules, such as $s...
formulas of basic operations and trigonometry.

Полный текст и комментарии »

  • Проголосовать: нравится
  • +11
  • Проголосовать: не нравится

86.
Автор i_m_abbhay, история, 19 месяцев назад, По-английски
Help My 14-Year-Old Brother Love Competitive Programming! Hi Codeforces! My 14-year-old brother (10th standard, India) loves gaming (Minecraft, chess) and knows basic math but has little coding experience due to rote learning and poor schooling. I want him to enjoy competitive programming and excel. How do I make it fun? Context: He’s new to coding (some Scratch, Python). Questions: Fun, beginner-friendly platforms or problems for a teen? How to keep him motivated through tough problems? Best resources (videos, apps) for a 10th-grader? Game-like coding contests or communities for kids? Plan: Start with CodeCombat, solve easy HackerRank problems together, reward his first “Accepted.” Share tips or stories on making competitive programming fun for a beginner! Thanks! i_m_abbhay
knows basic math but has little coding experience due to rote learning and poor schooling. I want

Полный текст и комментарии »

  • Проголосовать: нравится
  • +10
  • Проголосовать: не нравится

87.
Автор Shameek, история, 7 лет назад, По-английски
Cannot figure out the error.... [link to question](https://www.hackerearth.com/practice/math/number-theory/basic-number-theory-2/practice-problems/algorithm/zoro-and-his-curiosity-1/description/) but that isnt my doubt so sum of all coprime numbers with n upto n = sum of all numbers part of phi(n) = phi(n)*(n/2) i wrote the code for it.. apparently my function where i do the above computation was erroneous.. i tried stresstesting...[here is my codee](https://ideone.com/qg9akU) its not giving correct anwer from around 1650... can someone please help? my functionname is phifunc editorial is phi (P.S. i know that using sieve its n loglog n but both the editorial and my solution are sqrt n to it)
[link to question](https://www.hackerearth.com/practice/math/number-theory/basic -number-theory-2

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

88.
Автор guptaji30, история, 5 лет назад, По-английски
how to approach adhog , basic math questions ? I was giving this round https://codeforces.me/contest/1542 and wasn't able to solve problem B. Though after just a small hint I was able to solve it but I can't get over the fact that I wasn't able to approach this question . are the some good resources for constructive algorithm questions or its just natural for some people ? if there are some good resources please do share them. It's not just the mentioned contest I want to improve ability to solve constructive algorithm questions in general. thanks in advance
how to approach adhog , basic math questions ?

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

89.
Автор phpduke, история, 14 месяцев назад, По-английски
[Guide] Meta HackerCup AI Meta HackerCup is unique, as it is the only place as far as I know that allows anyone to compete their AI models against top human competitors live! Without a lot of introductory blogs on how to get started competing in AI track, it becomes daunting to start & hence this blog. Received a dozen messages asking how we built a winning solution to last year's Meta Hacker Cup, will write separate post on that maybe. A lot has changed from last year to this, thinking models are already very good at competitive programming model out of the box. This is good because it lowers bar of entry participation while pushing bar for creating a differentiated top solution. Goal of contest is to build an automated system that generates solution to competitive programming problems WITHOUT any human intervention. That is you cannot nudge/hint your AI system leveraging your human intuitions. Anatomy of a typical solution ============================= A lot of the solutions/ideas can be dissect...
verifiable test environment, you can smoke that benchmark with RL. Coding & Math both fit very

Полный текст и комментарии »

  • Проголосовать: нравится
  • +33
  • Проголосовать: не нравится

90.
Автор dfsof, 3 года назад, По-английски
[Spoilers]Solution to PE864, and an invitation to our QQ group! This blog targets at persons who are interested in (computational) number theory, or struggling to solve this problem. It contains many spoilers (even the final answer). Therefore, if you want to solve it on yourself, please close immediately (or add an upvote). The idea of this blog is quite similar to ecnerwala's comments on the Project Euler thread, but the thread is not open and only visible to persons who solved this problem. In fact, I have finished this problem by myself. **1. Problem Statements** [Link to problem](https://projecteuler.net/problem=864). Let $C(n)$ be the number of [square-free](https://en.wikipedia.org/wiki/Square-free_integer) integers of the form $x^2+1$ ($1 \leq x \leq n$). For example, $C(10)=9$ (only $7 \times 7+1 = 2 \times 5 \times 5$ is not square-free) and $C(1000)=895$. Find $C(123567101113)$. **2. The basic idea, and obstacle** The first basic idea is the [principle of inclusion-exclusion (PIE)](https://en.wikipedia.org/wiki/Inclusion%E...
-free) and $C(1000)=895$. Find $C(123567101113)$. **2. The basic idea, and obstacle** The first

Полный текст и комментарии »

  • Проголосовать: нравится
  • -20
  • Проголосовать: не нравится

91.
Автор adamant, 10 месяцев назад, По-английски
Fastest bitwise convolutions Hi everyone! There are 3 roughly similar problems on Library Checker: - **[Bitwise Xor Convolution](https://judge.yosupo.jp/problem/bitwise_xor_convolution)** - **[Bitwise And Convolution](https://judge.yosupo.jp/problem/bitwise_and_convolution)** - **[Subset Convolution](https://judge.yosupo.jp/problem/subset_convolution)** All of them ask us to find $c_0, \dots, c_{2^n-1}$, where $$ c_k = \sum\limits_{i \circ j = k} a_i b_j, $$ where $\circ$ stands for bitwise xor, bitwise and, and "disjoint or" correspondingly. As of now, my submissions are the fastest one for all 3 problems, and in this blog I'd like to explain how it is achieved. XOR / AND convolutions are fairly simple, which is why my **30 ms** submissions are closely followed by others. However, for subset convolution, my submission uses **94 ms** with just **34 MiB**, while all other submissions (except the one by ~Qwerty1232,2026-02-15 on the second place, whose approach is similar to mine) use at least 3...
polynomial multiplication Now, there are several ways to implement basic 20x20 multiplication as well

Полный текст и комментарии »

  • Проголосовать: нравится
  • +101
  • Проголосовать: не нравится

92.
Автор I_love_Hoang_Yen, 12 лет назад, По-английски
[GYM] 2014-2015 CT S02E06 — Solution [problem:100506A] For this problem, you need to calculate: $sum(distance(u, v)) / (some_constant)$ How to calculte $sum(distance(u, v))$ efficiently? Obviously, you cannot iterate through all pair of vertices u and v. That would take at least $O(N^2)$. When calculating the sum, notice that you need to add one edge multiple times. There are only N edges, but for each edge, in naive solution, you added it multiple times. So now you can see an idea for optimizing the naive solution: For each edge, count how many times it appear in $sum(distance(u, v))$ and add it to result. Turns out this is quite simple: For edge $(u, v)$ where u is parent of v in the tree, the path going through it must have the form: "something --> u --> v --> something". The number of such path is $size(subtree(v)) * (n - subtree(v))$. [My code](http://ideone.com/DLQFOJ) [cut] [problem:100506B] Let's call the vertices which at least one bus trip go through "important vertices". It is easy to...
use these notes to make certain sum (note that you can subtract). In math, this is check if an

Полный текст и комментарии »

  • Проголосовать: нравится
  • +87
  • Проголосовать: не нравится

93.
Автор tenebrix, 7 месяцев назад, По-английски
Finding a coprime to a given number (till LONG_LONG_MAX) **Context:** After reading the problem below, you might say there's a more optimal way to solve it. However, this note is meant to highlight a specific question: *If you run a basic loop to solve this, will it actually get a TLE (Time Limit Exceeded) when given many test cases and no further restrictions?* Many beginners who don't know much about number theory might just brute-force it, and then wonder how their code actually passed. Let's see why. Say you are given a number $n$ ($7 \le n \le 10^{18}$) and asked to find two distinct numbers $a$ and $b$ such that: * $a + b = n$ * $\gcd(a,b) = 1$ (meaning $a$ and $b$ are coprimes) * **Important: Neither $a$ nor $b$ can be 1.** Because we are strictly not allowed to use 1, the obvious choice of setting $a = 1$ and $b = n - 1$ is gone. So let's look at the math. As we know via the Euclidean property: $\gcd(a,b) = \gcd(a, a+b)$ Since $a + b = n$, we can rewrite this as: $\gcd(a,b) = \gcd(a, n)$ Thus...
. However, this note is meant to highlight a specific question: *If you run a basic loop to solve

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

94.
Автор arvindf232, история, 12 месяцев назад, По-английски
Quadratic binary energy function minimisations by Flow ## Motivations I tried to read [https://codeforces.me/blog/entry/148438](https://codeforces.me/blog/entry/148438) and failed. It contains a lot of extra explanations and intuition that I either already knew or could reconstruct immediately. That is not inherently bad, but for me personally it made the key ideas harder to see. (I think most contestants would not struggle with visualising binary logical relations...) As I asked around (and with help from LLMs), it became clear that the underlying structure is the Kolmogorov–Zabih characterization of which quadratic binary energies are solvable via a single max-flow. This blog is essentially a reweighting of that material: shorter, more “algebraic”, and aimed at people who are already comfortable with max-flow / min-cut and with abstracting away implementation details. This blog is also just essentially an extremely long comment that is too long to fit in comment section. ## Declarations While writing this, I did **not**...
` equals `b`, and `0` otherwise. In math, this is the Kronecker delta $\delta_{ab}$. * Logical

Полный текст и комментарии »

  • Проголосовать: нравится
  • +95
  • Проголосовать: не нравится

95.
Автор Geothermal, история, 6 лет назад, По-английски
Codeforces Round #709 / Technocup 2021 Final Round - Unofficial Editorial As the editorial for round #709 has yet to be released, I thought I'd write up and post my solutions to the problems (with the exception of Div. 1 F). My code may not be especially useful, since it's a bit messier than necessary in some cases, but I'm hoping that the written explanations will be fairly helpful. Feel free to comment if you have any questions! --- #[2A &mdash; Prison Break](https://codeforces.me/contest/1484/problem/A) By simply playing around with a few small test cases, you might guess that the answer is always equal to $ab$. This intuition is correct; let's prove it formally. Consider a graph with $ab+1$ vertices including one vertex representing each cell of the prison, one vertex representing the outside world, and an edge for each wall of the prison connecting the two vertices on either side of the wall. Then, observe that a set of walls we can remove such that the outside world is accessible from every cell is equivalent to a set of edges that s...
://codeforces.com/contest/1484/submission/110672990) --- #[2C/1A — Basic Diplomacy](https

Полный текст и комментарии »

  • Проголосовать: нравится
  • +207
  • Проголосовать: не нравится

96.
Автор SonuGupta001, история, 2 года назад, По-английски
How much mathematical knowledge do I need to prove the correctness of a solution? I am an engineering student(EE) , and I am familiar with high school math as well as the applied mathematics(thats what typically taught in an engineering degree). I am curious how much mathematical knowledge do I need to to prove the solutions/ideas and its correctness. I am familiar with basic proving techniques like, direct proof through the logic, proof by induction, proof by contradiction. But I have only studied them for the class so I cant really say I am well versed with them and may get stuck while proving some good problems. My aim is to reach to expert or candidate master level. So which type of mathematical concepts frequently occurs in the problems of these rating ranges, and what level of mathematical maturity and proofs do I need for them so that I can efficiently solve these problems to reach to my desired level. Thanks.
I am an engineering student(EE) , and I am familiar with high school math as well as the applied

Полный текст и комментарии »

  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

97.
Автор Nickolas, 15 лет назад, По-русски
Surprise Language Round #6: editorial Roco is a very simple language. On one hand, it's esoteric, so everything you need to know about it fits in two pages. On the other hand, it's powerful enough to enable writing rather complicated programs in it without racking one's brains over each elementary operation (like in Brainfuck). Being able to refer variables using names (numerical, but names nevertheless) is already a gift to the programmer :-) #### [problem:188A] As usual, the first problem tests the competitor's understanding of basic arithmetic operations. The solution is very similar to the example. ~~~ iin [0] mul [1] [0] 2 dec [1] mul [1] [1] [0] iout [1] ac ~~~ Starting with the second one, the problems need learning the main feature of the language --- the coroutines. [cut] A coroutine is a named piece of code executed in an endless loop. Something in between a procedure (without input parameters and variables, but with a name used for calling it) and a loop (without loop counter or break cond...
understanding of basic arithmetic operations. The solution is very similar to the example. ~~~ iin [0] mul

Полный текст и комментарии »

Разбор задач Surprise Language Round 6
  • Проголосовать: нравится
  • +38
  • Проголосовать: не нравится

98.
Автор abacadaea, 14 лет назад, По-английски
Editorial for Codeforces #174 Here is the editorial for Round #174. Thanks for participating. We hope you enjoyed the problems! :) Div2 A We didn’t expect this problem to be so hard :(. This problem can be solved by brute forcing. For any $x,$ you can compute $x^1, x^2, \dots, x^{p-1} \mod p$ in $O(p)$ time (iteratively multiply cur = (cur * i) % p, not use pow in math library!), so overall brute force will be $O(p^2)$ time. Note: there is actually $O(\sqrt{p})$ [algorithm.](http://codeforces.me/blog/entry/7037) The problem was written by abacadaea. Div2 B We first note that players who have folded do not affect our desired answer. Then, we can do casework on the number of players who are currently “IN”. If no cows are “IN”, then all the players who are “ALLIN” can show their hands. If exactly one cow is “IN”, she is the only one who can show, so the answer is 1. If two or more cows are “IN”, no one can show their hands. Then we simply count the number of cows of each type and check for each...
multiply cur = (cur * i) % p, not use pow in math library!), so overall brute force will be $O(p^2

Полный текст и комментарии »

Разбор задач Codeforces Round 174 (Div. 1)
Разбор задач Codeforces Round 174 (Div. 2)
  • Проголосовать: нравится
  • +103
  • Проголосовать: не нравится

99.
Автор Nickolas, 6 лет назад, По-английски
Microsoft Q# Coding Contest – Summer 2020 — Warmup: editorial The warmup round is over; I hope you enjoyed it and learned something new in the process! Here are the explanations for the contest problems and pointers some extra resources that can help you learn more about the respective topics before the main contest. You should also be able to see the solutions of the contest participants and to solve the problems in practice mode. ## A: "Distinguishing Unitaries" problems Here is the editorial for the problems: https://assets.codeforces.com/rounds/1356/A1-A5.pdf. > These problems are [published in the Quantum Katas](https://github.com/microsoft/QuantumKatas/tree/master/DistinguishUnitaries), so that you can see the testing harness used for the problems and use it for testing your solutions in the main contest. ## B: Reversible computing Reversible computing is a branch of quantum computing that deals with expressing classical computations in a reversible manner (i.e., so that the computation has a unique input state for each ou...
the math used in that solution in the [workbook](https://github.com/microsoft/QuantumKatas/blob/master

Полный текст и комментарии »

  • Проголосовать: нравится
  • +68
  • Проголосовать: не нравится

100.
Автор thecodewolf, история, 5 лет назад, По-английски
Hello World! Need guidance Hi, I have been coding basic programs since some time, but my algorithm knowledge is quite inadequate. My Math skills are really bad, I'm not good with formulas and stuff, but implementation wise I feel I can learn and grow, do you have any blog links or other resources for a beginner like to to learn algorithms and be able to solve harder problems than my current level, considering I'm not so good at Math. Any help is highly appreciated! Thanks in advance! Happy coding...!!
Hi, I have been coding basic programs since some time, but my algorithm knowledge is quite

Полный текст и комментарии »

  • Проголосовать: нравится
  • +16
  • Проголосовать: не нравится

101.
Автор adamant, история, 4 года назад, По-английски
Combinatorial species: An intuition behind generating functions Hi everyone! The usage of generating functions is quite common in competitive programming these days. But it seems to happen so, that they're mostly presented as a way to simplify formal manipulation with polynomial coefficients, rather than something meaningful. But there actually is a meaning to all of this, and today I'm going to shed a light on it. Alongside the blog post we'll uncover the combinatorial meaning of - The addition $F(x)+G(x)$, - The multiplication $F(x)G(x)$, - The exponent $\exp F(x)$, - The logarithm $\log F(x)$, - The sum of the infinite geometric progression $\frac{1}{1-F(x)}=1+F(x)+F^2(x)+\dots$, - The general composition $F(G(x))$ for the generating functions $F(x)$ and $G(x)$ and the underlying structures they represent. ### Prerequisites - Basic notion of set theory (cardinality of sets, mappings, bijections, cartesian product, disjoint union, etc); - Polynomials and formal power series (representation, convolution formula, power seri...
- Basic notion of set theory (cardinality of sets, mappings, bijections, cartesian product, disjoint

Полный текст и комментарии »

  • Проголосовать: нравится
  • +380
  • Проголосовать: не нравится

102.
Автор upsc_aspirant, история, 4 года назад, По-английски
Need help with Maths I am scheduled to take a math exam in September 2024 and I am seeking guidance on the best resources and books to help me excel in this exam. Until October 2023, I am able to devote 5 hours per day to studying, after which I will need to shift my focus to other subjects. Where I come from, there's little to no guidance from for this particular subject in this exam, so my best bet is this community. Any help is much appreciated. To provide some context, I have already completed preliminary courses in Calculus (single variable), Differential Equations, and Linear Algebra. The exam syllabus includes the following topics: **MATHEMATICS PAPER I** **(1) Linear Algebra:** Vector spaces over R and C, linear dependence and independence, subspaces, bases, dimensions, Linear transformations, rank and nullity, matrix of a linear transformation. Algebra of Matrices; Row and column reduction, Echelon form, congruence's and similarity; Rankof a matrix; Inverse of a matrix; Solution o...
I am scheduled to take a math exam in September 2024 and I am seeking guidance on the best

Полный текст и комментарии »

  • Проголосовать: нравится
  • -15
  • Проголосовать: не нравится

103.
Автор I_love_Constructive, история, 3 года назад, По-английски
Common Impartial Combinatorial Games Theory Techniques in Competitive Programming In competitive programming, several types of combinatorial game theory questions are frequently encountered. These problems often involve strategies to win the game based on mathematical observations and proofs. In this blog, we'll discuss four common types of combinatorial game theory questions and their solutions. **1. Invariance** **2. Symmetry** **3. Reduction to Nim Game problems** **4. Solving using Dynamic Programming** In invariance and symmetric problems, certain properties of the game remain unchanged throughout its course. Although some may require mathematical proof, others can be solved through careful observations. **- Whytoff's Game:** The game involves two piles of stones with x and y stones, respectively. Two players, P1 and P2, take turns choosing a pile and removing at least one stone from it. The player who cannot make any move loses. Let's remove the 'a' stone from both piles such that a >= min(x, y). Whoever can't make any move will lose. **Solutio...
complex game into the basic Nims Game using Grundy Numbers. **-Variation 4 of Nim Game

Полный текст и комментарии »

  • Проголосовать: нравится
  • +19
  • Проголосовать: не нравится

104.
Автор Hazemzz, история, 10 лет назад, По-английски
How can i enhance my skills in solving Mathematics and number theory related problems ? How can i enhance my skills in solving Mathematics and number theory related problems ? my strategy was that pic math problem ..try as much u can then if i couldn't figure a solution . i look at red person and learn how they solve it and read the tutorial ans so on ... that really helped me in learning basic stuff .but this method is so slow ..i need a book or something in math and number theory any tips ?
learning basic stuff .but this method is so slow ..i need a book or something inmath and number theory

Полный текст и комментарии »

  • Проголосовать: нравится
  • +9
  • Проголосовать: не нравится

105.
Автор nithinsanjey, история, 9 лет назад, По-английски
First 4 codeforces contests. Learning from mistakes. I am a full time corporate programmer in Java for web development and a CS engineering graduate. Here I would like to share my experience through my first 4 Codeforces contests. Programming for web development is a lot different from programming in competitive contests. In web, much work depends on where the data comes from(customer/database) and where the data goes to (database/UI). But here, in Codeforces, programming is Math. And so depends on algorithm and data structures. As Knuth points out, Algorithm + Data structure = Programming I would like to write on my learning in each part separately. ### Algorithm I was jumping into programming immediately on seeing the problem which worked well in A problems but not to others. I realize that I should I should take my pen & paper and make an algorithm before jumping into code. Otherwise I consumed a lot of time figuring out the algorithm while coding while paper is easier and more intuitive as a beginner(at least for me)....
, in Codeforces, programming is Math. And so depends on algorithm and data structures. As Knuth

Полный текст и комментарии »

  • Проголосовать: нравится
  • +38
  • Проголосовать: не нравится

106.
Автор trekhleb, 9 лет назад, По-английски
Algorithms and Data Structures in JavaScript Hello Readers! I've recently launched [JavaScript Algorithms and Data Structures](https://github.com/trekhleb/javascript-algorithms) repository on GitHub with collection of classic algorithms and data-structures implemented in ES6 JavaScript with explanations and links to further readings and YouTube videos. There is also [Algorithms and Data Structures YouTube playlist](https://www.youtube.com/playlist?list=PLLXdhg_r2hKA7DPDsunoDZ-Z769jWn4R8) that contains all the videos mentioned in that repository so you may just go and take this hand-made online learning course :) So I guess you've already grasp main idea of the project - ** helping developers to learn and practice algorithms and do it in JavaScript** . [cut] To make this process even smoother I've tried to put some **graphical illustrations** for each algorithm and data structure where it was possible just to make the idea behind those algorithms to be easily grasped and memorized. You also may find some practical i...
algorithms or data structure works, what basic operations they have (let's say polling for heap) and

Полный текст и комментарии »

  • Проголосовать: нравится
  • +35
  • Проголосовать: не нравится

107.
Автор avantika_05, история, 5 лет назад, По-английски
Complete Topic List for Competitive Programming (Re-revised && Updated) Suggestions are welcome. BEFORE ENTERING INTO THE LIST, I HAVE A SUGGESTION FOR CODEFORCES. DARK THEME BUTTON AND CODE LINTING FEATURE FOR CODEFORCES. "PROBLEM OF THE DAY" ON THE RIGHT SIDE OF THE HOMEPAGE. NEW PROBLEMS ALERT PAGE. LET ME KNOW YOUR OPINION FRIENDS :) #### Complete Roadmap to Competitive Programming #### ** IMPORTANT CONCEPTS: ** Basic Programming Object Oriented Programming Time && Space Complexity Loops, Arrays, Math, Probability Circular Arrays, Matrices, Strings Permutations && Combinations Bit Masking && Bit Manipulations Recursion && Backtracking Dynamic Programming Prefix Sum, Precomputations Square Root Decomposition Sliding Window Modular Arithmetic Number Theory, Geometry Greedy Approach, Bruteforce Two Pointer Approach Linked Lists, Stacks, Queues Sets, Heaps && Priority Queues Hashing, Trees and Graphs Binary Search Trees, Search Trees Tries, Segment Trees, Fenwick Trees Minimum Spanning Trees, Suffix Trees M...
#### ** IMPORTANT CONCEPTS: ** Basic Programming Object Oriented Programming Time && Space

Полный текст и комментарии »

  • Проголосовать: нравится
  • -22
  • Проголосовать: не нравится

108.
Автор RedNextCentury, 11 лет назад, По-английски
[Gym Contest Editorial] Egyptian Collegiate Programming Contest (ECPC 2015) **Note:** All complexities mentioned in this editorial are per test case. ### A: Arcade Game Let $perm$ be the number of permutations for the digits of $n$. First, sort all these permutations in decreasing order and give each permutation a rank (0 is the largest permutation, 1 is the second largest and so on). $ans[0]=0$ $ans[1]=\displaystyle \frac{1}{perm}$ $ans[rank]=\displaystyle \frac{1}{perm} * (1+ans[rank-1]+ans[rank-2]+...)$ find the rank of $n$ and print it's value from the array. Note: the relation mentioned above can be reduced to: $ans[rank] = \displaystyle \frac{(perm+1)^{rank-1}}{perm^{rank}} $ Which could be written as (to avoid overflow): $ans[rank] = \displaystyle \frac{(\frac{perm+1}{perm})^{rank-1}}{perm} $ Complexity: $O(rank)$ ### B: Unlucky Teacher There are two ways for an answer to a question to be unique: 1) this question was answered correctly in one of the papers. 2) this question was answe...
: Connecting Graph In this solution, I am going to use a more basic version of DSU, which is

Полный текст и комментарии »

  • Проголосовать: нравится
  • +41
  • Проголосовать: не нравится

109.
Автор twoplusthree, история, 3 года назад, По-английски
ICPC Asia West Continent Final Contest 2023 — Problem A and E #### Motivation A few weeks back I had the opportunity to attend the [ICPC Asia West Continent Finals 2023](https://codedrills.io/contests/icpc-asia-west-continent-final-contest-2023) along with my teammates [user:VS-Codes,2024-04-11] and [user:om_mittal7,2024-04-11], where we encountered the following problems as part of the contest problemset. We weren't able to solve E in contest, and that kept bugging me for quite a while. I was especially motivated to try and prove the claims that we had made in the contest, which proved to be quite a hard challenge. Finally, when I did manage to cook up solutions with reasonably sound proofs, the underlying ideas and the little observations made along the way felt so elegant that I decided to document it here for future reference, and to share with the community. I hope these ideas turn out to be useful for someone stuck in a similar place as I was. Looking forward to your thoughts and suggestions! ## [A. Basic Vocabulary](https://cod...
as I was. Looking forward to your thoughts and suggestions! ## [A. Basic Vocabulary](https

Полный текст и комментарии »

  • Проголосовать: нравится
  • +70
  • Проголосовать: не нравится

110.
Автор tesfaymebre, история, 3 года назад, По-английски
Contest #2 editorial ### [A.Party](https://codeforces.me/gym/519057/problem/A) <spoiler summary="Hint"> Try to think in a level order manner </spoiler> <spoiler summary="Solution"> We can notice that the Level of the Employee matters for it to have dinner with the others. Which is basically his level in the graph which decides this. So what we can do is to construct the graph with keeping track of the indegree of the node and doing **BFS** starting from the nodes which have 0 indegree because they are the top level managers and collecting all of them who have the same level to one place. </spoiler> <spoiler summary="Code"> ~~~~~ import heapq, math from itertools import * from bisect import * from collections import * from sys import stdin, stdout def pr(out): return stdout.write(f"{out}\n") def input(): return stdin.readline().rstrip() def int_inp(): return int(input()) def inp_int_l(): return list(map(int, stdin.readline().split())) def ...
> ~~~~~ import heapq, math from itertools import * from bisect

Полный текст и комментарии »

  • Проголосовать: нравится
  • -1
  • Проголосовать: не нравится

111.
Автор __DopamIne2, история, 15 месяцев назад, По-английски
Newbie to pupil I think needed topic for newbie to pupil. 1. Practice 2.basic implementation 3.STL (vector, string, set,map,pair) 4.basic math and number theory. 5.binary search 6.basic bitmasks.
, string, set,map,pair) 4.basic math and number theory. 5.binary search 6.basic bitmasks.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -12
  • Проголосовать: не нравится

112.
Автор Proofy, 16 месяцев назад, По-английски
[Tutorial] Bitmasks and sets are two sides of the same coin ### **Prescript** This is a beginner concept that I think many people know but I haven't seen written explicitly anywhere, and I have explained it before multiple times to many people asking me "where can I learn more about bitmasks and bitwise operations?" I haven't seen this explained anywhere so that I can refer them to this resource. Hence, I'm writing about it myself. The techniques in this blog are very intuitive and simple to the extent that you can wonder "why are we even talking about this?" But I do often find it very useful to state something explicitly (and formally), because sometimes intuition can be misleading if not held accountable and made explicit. Throughout the blog, I try to make the concepts as easy to read as possible while also not eliminating formality. So, I keep the more formal writings enclosed inside spoiler blocks <spoiler summary="like this one"> I am a spoiler block, I contain the formal jargon. </spoiler> which you can feel free to ...
/basic set theory ### **Introduction** If you have taken a discrete math course, you probably saw

Полный текст и комментарии »

  • Проголосовать: нравится
  • +104
  • Проголосовать: не нравится

113.
Автор Waynebot, история, 7 лет назад, По-английски
How to use extended Eucledian Algorithm in this problem? Hello Everyone, [Problem](https://www.hackerearth.com/practice/math/number-theory/basic-number-theory-1/practice-problems/algorithm/monk-and-fredo-cm-number-theory/) I am trying to solve this problem But stuck at some point. I used EX. Eucledian Algorithm to check whether Solution exist or not but not able to understand how to build logic to get total number of ways. Can you help me in solving this?
Hello Everyone, [Problem](https://www.hackerearth.com/practice/math /number-theory/basic-number

Полный текст и комментарии »

  • Проголосовать: нравится
  • -2
  • Проголосовать: не нравится

114.
Автор kamilszymczak1, история, 4 года назад, По-английски
[Tutorial] Euler's phi function, its properties, and how to compute it Hello codeforces! In one of the recent contests there appeared [a problem](https://codeforces.me/problemset/problem/1717/E) which involved Euler's phi function, and I figured I could write a bit about this function here. First, I will briefly introduce Euler's phi function, talk about two of its properties, and give you proofs of both of them. Ultimately, it will lead us to a way to compute the value of this function for some given integer $n$ with reasonable time complexity. [cut] <br> I tried to keep this post quite basic, so that it's accessible to everyone. Therefore, if you are already quite good at some topic mentioned here, feel free to skip a section or two. Also, I would like to say thank you to my friend, [user:sysia,2022-09-11], who helped me a lot with writing this post and suppressed my tendency to write too much. <br> ### What is Euler's phi function? Euler's phi function (which may be also called Euler's totient function) is a function that g...
] I tried to keep this post quite basic, so that it's accessible to everyone. Therefore, if

Полный текст и комментарии »

  • Проголосовать: нравится
  • +217
  • Проголосовать: не нравится

115.
Автор Siyah, история, 12 месяцев назад, По-английски
Euler to AVX: Hi, I'm AmirMohammad (commonly known as **Danet**). I was inspired to write this article after completing my Calculus 1 course to bridge the gap between theory and implementation. Naturally, as a non-native speaker, the translation and editing process involved some assistance. If you spot any technical or linguistic errors, I would be grateful if you pointed them out! ## 1. Mathematical Foundations and Definitions The trigonometric and hyperbolic function families are intrinsically linked through complex analysis, specifically via Euler's formula: $$ e^{ix} = \cos x + i \sin x $$ ### 1.1 Trigonometric Functions (Circular Functions) These functions are defined geometrically based on a point $(x, y)$ on a unit circle of radius 1, where the angle subtended at the origin is $\theta$ (or $x$ radians): $$ \begin{align} \sin x &= y \\ \cos x &= x \\ \tan x &= \frac{\sin x}{\cos x} = \frac{y}{x} \\ \csc x &= \frac{1}{\sin x} \\ \sec x &= \frac{1}{\cos x} \\ \cot x...
, typically implemented in the system's math library (`libm`). ### 3.1 Range Reduction (Crucial Step

Полный текст и комментарии »

  • Проголосовать: нравится
  • +21
  • Проголосовать: не нравится

116.
Автор deinepapa, история, 13 месяцев назад, По-английски
Network Flow Algorithm Hey everyone! <br> We were taught basic network flow in our algorithms course in university and I started to learn it. Found this useful blog blog by [user:Zhtluo,2025-10-21] [link](https://codeforces.me/blog/entry/141680) ### Target Audience. This post is for anyone who has some free time :)<br> <spoiler summary="Help if you can spare some time"> To do the first kind of problems Graph Matching. I went through William Fiset’s amazing YouTube playlist on Network Flow Since I learned it all from one source, I wanted to write this blog to share what I understood — and more importantly — to ask the community for new perspectives and interesting problems to explore using this algorithm. <br> </spoiler> ### Basic <spoiler summary="What is network flow"> Imagine you have a water system:<br><br> A big tank (source) that sends water to A fountain (sink) through Several pipes (edges) connected by junctions (nodes). <br><br> Each pipe has a limit — called capacity — whic...
Hey everyone! We were taught basic network flow in our algorithms course in university and

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

117.
Автор Nourhan_Abo-Heba, история, 12 месяцев назад, По-английски
GCD, LCM, Modular Arithmetic & Generating Divisors — a Codeforces-style Guide **Tags:** `#math` `#number-theory` `#implementation` `#templates` **Difficulty:** ★☆☆ — ★★☆ **TL;DR:** Treat every number as a multiset of prime powers (a “box of primes”). * `gcd` = take **minimum** exponent for each prime. * `lcm` = take **maximum** exponent for each prime. * Use Euclid (`%`) for fast `gcd`. * For modular division with prime modulus, use Fermat → inverse = `pow(a, MOD-2)`. * Generate all divisors by recursion over prime powers. --- ## 1) Numbers = Boxes of Prime Factors Example: * `12 = 2^2 * 3^1` → box: {2,2,3} * `6 = 2^1 * 3^1` → multiplying by 6 is like *adding* `2` and `3` into the box. If * `24 = 2^3 * 3^1` * `30 = 2^1 * 3^1 * 5^1` then `gcd(30,24)` uses **min exponents**: `2^min(3,1)*3^min(1,1)*5^min(0,1) = 2^1 * 3^1 = 6`. `lcm` uses **max exponents**: `2^3 * 3^1 * 5^1 = 120`. --- ## 2) GCD — Properties & Implementation Properties: * `gcd(a,b) = gcd(b,a%b)` (Euclid) * `gcd(a,0) = a` * `gcd(a,b) = gcd(a-b, b)` (su...
**Tags:** `#math` `#number-theory` `#implementation` `#templates` **Difficulty:** ★☆☆ — ★★

Полный текст и комментарии »

  • Проголосовать: нравится
  • -22
  • Проголосовать: не нравится

118.
Автор 7oSkaaa, история, 5 лет назад, По-английски
Topics Problems Good Day to you! While a lot of us, when he begins to start competitive programming he found difficult to found problems on some topics in the beginning to practice of it, and same thing for a lot of ICPC Communites that they have started. These are some topic not advanced and videos, problems and articles on them. <br> <spoiler summary="Prefix Sum & Frequency Array"> [Wonderful Coloring](https://codeforces.me/contest/1551/problem/B1) [Do Not Be Distracted](https://codeforces.me/contest/1520/problem/A) [Letter](https://codeforces.me/problemset/problem/43/B) [Pangram](https://codeforces.me/problemset/problem/520/A) [Andryusha and Socks](https://codeforces.me/contest/782/problem/A) [Count Numbers](https://codeforces.me/group/c3FDl9EUi9/contest/262795/problem/A) [Count Characters](https://codeforces.me/group/c3FDl9EUi9/contest/262795/problem/B) [Range Sum Query](https://codeforces.me/group/c3FDl9EUi9/contest/262795/problem/E) [Count a's](https...
) [Math House](https://www.mathwarehouse.com

Полный текст и комментарии »

  • Проголосовать: нравится
  • +23
  • Проголосовать: не нравится

119.
Автор Aditya_Sharma, история, 6 лет назад, По-английски
MOTIVATION FOR BEGINNERS You need to have a lot of patience when you start your coding journey. At first,you need to learn basics like for loops,basic math etc. After 6 months you need to start solving questions on code-forces and other platforms. You need to have a lot of patience in order to increase ratings. It is a long process. First solve easy problems then increase levels, 1 step at a time. After learning basics of a language like c++(preference) or any other language ,you need to start learning data structures topic wise. Again you need to give time to each topic. Then after many days you will self realize that you have come a long way ahead .
basics like for loops,basic math etc. After 6 months you need to start solving questions on code

Полный текст и комментарии »

  • Проголосовать: нравится
  • -47
  • Проголосовать: не нравится

120.
Автор Saurav_Paul, история, 6 лет назад, По-английски
Command-line virtual-assistant for competitive programming. It is a terminal-based virtual assistant especially made for competitive programming. It has a lot of features, including running python or c++ file, parsing problem set with test cases and test against all the cases in one click, test with brute force solution, and many more. It will help you to boost your programming skill and help you to do a good performance in the programming contest. It can give voice reply and take your voice command. You can turn off or on these features. Basic settings can be easily changed from config option. For installing write the given commands, > pip3 install wheel and > pip3 install ai-virtual-assistant I recommand after installing checkout the config file. The config can be open by the given command, > jarvis -config ![Welcome Screen](/predownloaded/89/f3/89f33319c633e554ca00348b4a5bc41983f030c3.png) ## Programming Features - [x] [Run c++ or python program] - [x] [Competitive Companion Support] - [x] [parse proble...
can give voice reply and take your voice command. You can turn off or on these features.Basic

Полный текст и комментарии »

  • Проголосовать: нравится
  • +112
  • Проголосовать: не нравится

121.
Автор AquaMoon, 3 года назад, По-английски
Harbour.Space Scholarship Contest 2023-2024 (Div. 1 + Div. 2) Editorial Thank you for participation and we hope you enjoy this round ヽ(^ o ^)/. During the contest, there was a small issue in problem D. For those affected, we have skipped your duplicate submissions (if your duplicate submissions were not skipped, please let us know). We apologize again for any inconvenience caused. In addition, we are honored to invite you to our unofficial round tomorrow (*╹▽╹*) [Invitation to TheForces Round #22 (Interesting-Forces)](https://mirror.codeforces.com/blog/entry/119771) ### [1864A-Increasing and Decreasing](https://mirror.codeforces.com/contest/1864/problem/A) Idea : [user:wuhudsm,2023-08-27] <spoiler summary="Tutorial"> We use the following greedy construction: For all $i$ ($1<i<n$), set $a_i=a_{i+1}-(n-i)$. If $a_2-a_1 \geq n-1$, we've found a solution, otherwise there is no solution. Proof. Assume there's a solution which includes an index $i$ ($1<i<n$) such that $a_{i+1}-a_i>n-i$. We can make $a_j:=a_j+\Delta$ for all $j$ ($2 \le j ...
-27] Here is a basic $\Theta(n)$ dp solution. Before that let $k

Полный текст и комментарии »

  • Проголосовать: нравится
  • +201
  • Проголосовать: не нравится

122.
Автор felix-felicis, история, 6 лет назад, По-английски
Need some guidance Hey everyone.Hope u all are doing fine.I need a little help as I am stuck at one particular rating.I am generally able to solve problems upto 1300 level although the math ones do take time.I have knowledge about basic data structures such as array, map,vector,string and set and use a bit of C++ stl but I do not have any idea about any higher data structure or algorithm such as graph tree or dp. I just know their names as I frequently see their name in the editorial:) Can someone tell me what to learn now and then how to proceed further.I really want to improve but am just unable to solve the 1400 tag questions.
rating.I am generally able to solve problems upto 1300 level although the math ones do take time.I have

Полный текст и комментарии »

  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

123.
Автор Shisuko, история, 8 лет назад, По-английски
The Intuition Behind NIM and Grundy Numbers in Combinatorial Game Theory There are already many wonderful resources online for learning the basics to combinatorial game theory, but the intention I have for _this_ guide in particular is to try to make them more intuitive. Why does XOR work for Nim? Why does mex produce the Grundy numbers? When it was taught to me, it was more or less just as 'magic' to memorize, but now I think I have a decent understanding of why they are true, so now that I have a grasp of the intuition behind it, I decided I should record my thoughts into a blog. Nim games ================== Suppose we are playing a Nim game. As we know, Nim games usually follow this sort of template: - There are $n$ piles of stones, and each pile contains $p_1, p_2, p_3, \cdots p_n$ stones, where each of the $p_i$ is some nonnegative integer. This collection of piles defines our game state. - There are two players who take turns removing stones. The current turn player may remove as many stones as they wish, so long as all the stones come f...
integer that is **not** in this set." Let's consider a basic example, such as the Nim game where

Полный текст и комментарии »

  • Проголосовать: нравится
  • +173
  • Проголосовать: не нравится

124.
Автор grecil, история, 7 месяцев назад, По-английски
Blackboxing Lazy Segment Trees, the right way For the longest time, I only knew how to use the lazy segtree for Range Add / Range Sum queries. It would take me painstakingly long to solve problems which had lazy propagation in a slightly different form. I then discovered the [Atcoder Lazy Segment Tree template](https://atcoder.github.io/ac-library/production/document_en/lazysegtree.html) ([C++](https://github.com/atcoder/ac-library/blob/master/atcoder/lazysegtree.hpp) / [Python](https://github.com/not522/ac-library-python/blob/master/atcoder/lazysegtree.py)), which would allow you to solve any Lazy Propagation problem by just defining 6 mathematical parameters: `S`, `op`, `mapping`, `composition`, `e` and `id`. This blog is an attempt to explain the math behind Lazy Propagation in an intuitive manner using Socratic dialogue. I would recommend that you guys ponder over the questions before you read the answers. **Prerequisites:** You know how a standard segment tree works. You know how to build it, how to perform point updates, ...
to explain the math behind Lazy Propagation in an intuitive manner using Socratic dialogue. I would

Полный текст и комментарии »

  • Проголосовать: нравится
  • +21
  • Проголосовать: не нравится

125.
Автор HGGMco15, история, 4 месяца назад, По-английски
How to practice algorithm for newbie? Hi everyone, I just created a new account on Codeforces to practice competitive programming. I am currently a Newbie I am comfortable with basic programming syntax, but I want to improve my problem-solving skills systematically. I can usually solve problems A and B in Div. 3 or Div. 4 contests, but I often get stuck on problem C or when a problem requires specific algorithmic thinking. I would appreciate any advice on the following questions: 1. What core algorithms or mathematical topics should a Newbie master first to consistently solve Div. 3/Div. 4 C problems?What is the most effective way to practice? 2. Should I solve problems by specific tags (like greedy or math) or just pick random problems from the problemset within a specific rating range (e.g., 1100–1200)? 3. Are there any specific training sheets, ladders, or groups you recommend for someone at my level? Thank you for your time and guidance!
currently a Newbie I am comfortable with basic programming syntax, but I want to improve my problem

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

126.
Автор onceadreamer, 5 лет назад, По-английски
Realistically speaking can I become approx 1800 (in two months) by devoting like 1 hr max every day? (maybe skip a day once in a while) So I'm not new to programming, have basic knowledge of algo-ds, kinda weak at math tho. So was just wondering today what's the max I can achieve in two months by putting in like an hour a day or so. What do you people think? Anybody tried something similar before?
So I'm not new to programming, have basic knowledge of algo-ds, kinda weak at math tho.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -33
  • Проголосовать: не нравится

127.
Автор zscoder, история, 7 лет назад, По-английски
[Tutorial] Generating Functions in Competitive Programming (Part 2) Welcome to Part 2 of my tutorial on generating functions. The [first part](https://codeforces.me/blog/entry/77468) focused on introducing generating functions to those without any background in generating functions. In this post, I will demonstrate a few applications of generating functions in CP problems. Let us start with some relatively straightforward examples. Note: Unless stated otherwise, all computations are done modulo a convenient prime (usually $998244353$). Also, $[n]$ denotes the set $\\{1,2,...,n\\}$. ### Blatant Applications in Counting Problems **Problem.** [AGC 005 Problem F](https://atcoder.jp/contests/agc005/tasks/agc005_f) You have a tree $T$ with $n$ vertices. For a subset $S$ of vertices, let $f(S)$ denote the minimum number of vertices in a subtree of $T$ which contains all vertices in $S$. For all $1 \le k \le n$, find the sum of $f(S)$ over all subsets $S$ with $|S| = k$. Constraints: $n \le 2 \cdot 10^{5}$. <spoiler summary="Solution"> First, ...
, we need to do some basic counting. For a set of vertices $S$, let $t(S)$ denote the minimal subtree

Полный текст и комментарии »

  • Проголосовать: нравится
  • +518
  • Проголосовать: не нравится

128.
Автор UnexpectedValue, 21 месяц назад, По-английски
[Tutorial] A New Perspective on Numbers and Operators: Introducing Group Theory We often start our mathematical journey with counting, primes, and basic arithmetic. Then we encounter modular arithmetic, with its intriguing properties and theorems like Euclid's algorithm and the Chinese Remainder Theorem. But what if there's a deeper, more abstract framework that ties all these concepts together? You might have encountered hints that group theory is behind some clever algorithms and data structures ([like this comment suggests](https://codeforces.me/blog/entry/103174?#comment-915676)). But if you've tried to learn about it, you might have found resources that felt either too abstract and disconnected from your existing knowledge ([for instance](https://zhtluo.com/cp/from-burnside-to-polya-a-short-introduction-to-group-theory.html)), or too intimidating and complex ([like this one](https://codeforces.me/blog/entry/91731)). This blog aims to bridge that gap. We'll start with familiar ground in discrete math and modular arithmetic, and then progressively in...
We often start our mathematical journey with counting, primes, and basic arithmetic. Then we

Полный текст и комментарии »

  • Проголосовать: нравится
  • +93
  • Проголосовать: не нравится

129.
Автор Mario, история, 6 лет назад, По-английски
The Easy One! https://www.hackerearth.com/practice/math/number-theory/basic-number-theory-1/practice-problems/algorithm/the-easy-one-0de35805/description/ unable to understand how to implement it , i know the logic
https://www.hackerearth.com/practice/math/number-theory/basic -number-theory-1/practice-problems

Полный текст и комментарии »

  • Проголосовать: нравится
  • -5
  • Проголосовать: не нравится

130.
Автор ahnaf_cp, история, 18 месяцев назад, По-английски
Road to Pupil: Am I on the Right Track? Hey Codeforces! I'm Ahnaf, a beginner in CP and aiming to reach pupil in a month. I’m solving about 5 problems a day, mostly rated 800–900, and plan to solve around 100–120 problems at each rating before moving up (like 900–1000 next), by filtering recent problems by rating. My routine: I try to think about a problem for 30 minutes, then check the editorial if stuck, and finally implement it myself. I use C++ and I’m kinda comfortable with basic STL like vector, map, set, sort(), and unique(). I’d love to know if this is a good way to improve. Should I keep doing this? Also, what beginner topics should I focus on next to solve more and get better faster? So far, I’ve practiced basics of C++, math, brute force, and implementation. Any advice, topic lists, or practice plans from you guys would be awesome! Thanks a lot! — Ahnaf
myself. I use C++ and I’m kinda comfortable with basic STL like vector, map, set, sort(), and unique

Полный текст и комментарии »

  • Проголосовать: нравится
  • -18
  • Проголосовать: не нравится

131.
Автор SisaC, 20 месяцев назад, По-английски
A floating-point function maintenance method based on Taylor expansion It might be a well-known technique, but as a cyan, my perspective is quite limited. Regardless, I independently invented this and am posting it here. By the way, interesting educational blogs on Codeforces have been becoming increasingly rare lately... ## Example Problem Given an array of length $n$, initially filled with $1$s. You need to handle $Q$ operations. For the function $f(x)=\frac{1}{x}$: - Given an interval $[l,r]$ and a positive integer $x$, add $x$ to all elements in the interval. - Given an interval $[l,r]$, compute $\sum_{i=l}^r f(a[i])$, preserving four significant decimal digits of precision. Before this, I asked [user:chromate00,2025-04-04], who said this problem seemed utterly ridiculous and completely impossible at first glance. I believe anyone seeing this problem for the first time would agree. This blog will present a technique to solve this problem, and it can also replace $f(x)=\frac{1}{x}$ with any function whose derivative is relatively...
even outperform the most basic brute-force approach. Inspired by **DIVCNT1** (where min25 used

Полный текст и комментарии »

  • Проголосовать: нравится
  • +43
  • Проголосовать: не нравится

132.
Автор Bit4kid, 14 месяцев назад, По-английски
Editorial For CSEC ASTU Division I Contest Round 1 [Here](https://codeforces.me/contests/642928) is the contest link. All problems are from Codeforces' Problemset. #### [A. The Killer](https://codeforces.me/gym/642928/problem/A) <spoiler summary="Solution"> Ilia calls every **n** minutes and artists arrive every **m** minutes. We need to find how many minutes both happen at the same time within `z` minutes. These are the multiples of **lcm(n, m)** up to `z`, so the answer is simply `z // lcm(n, m)`. **Example:** If `n = 2`, `m = 3`, and `z = 9`, then `lcm(2, 3) = 6`, and only minute **6** overlaps → answer = **1**. ### Complexity: * **Per test case:** O(1) </spoiler> <spoiler summary="Code"> ```python3 from math import gcd def solve(): n, m, z = list(map(int, input().split())) lcm = n * m // gcd(n, m) print(z // lcm) if __name__ == "__main__": solve() ``` </spoiler> #### [B. Tired](https://codeforces.me/gym/642928/problem/B) <spoiler summary="Solution"> At...
"> ```python3 from math import gcd def solve(): n, m, z = list(map(int, input().split())) lcm = n

Полный текст и комментарии »

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

133.
Автор libnguyen2, 3 года назад, По-английски
[Discussion]: Solutions for IOI 2023 tasks + My solution to IOI23 Day1 P1 — Closing Time Apologies for the immense lack of math typing &mdash; this dummy have precisely 0 idea of how that works out (whoops). Google Sheets that sorts IOI task by amount of AC, average score, max score and stuffs, definitely not hand &mdash; typed by yours truly over 3 hours or something: https://docs.google.com/spreadsheets/d/14v9jfFU0hZ47uAvut27_YdZ9FQmp78rP7Rm48tRzPQQ/edit?usp=sharing (Data taken from https://stats.ioinformatics.org/tasks/) I know, this is definitely a weird thing for a Gray to make a blog out of all things, but yeah. For some reason there's no official editorial even after 1.5 months since the official contest, and no discussion blogs as well. So, yeah, I want to bring this up in order to actually see people discussing about the tasks of IOI23, as the task discussion blogs are always fairly interesting (to read) for me. Besides, I would love to see people actually explaining their ideas (how do you people even come up with that 40-line O(n^2) solution for Soccer, WHY ...
Apologies for the immense lack of math typing — this dummy have precisely 0 idea of how that

Полный текст и комментарии »

  • Проголосовать: нравится
  • +41
  • Проголосовать: не нравится

134.
Автор user_temp, 9 лет назад, По-английски
Problems for contest I just wanted to ask how can one one write problem statements for contest, I have an idea about a basic math problem(Div-2 B/C) but do not know where to submit it. Can anyone help?
basic math problem(Div-2 B/C) but do not know where to submit it. Can anyone help?

Полный текст и комментарии »

  • Проголосовать: нравится
  • -14
  • Проголосовать: не нравится

135.
Автор Ahmed_Mohamed_Al3adl, история, 20 месяцев назад, По-английски
Permutations and Combinations # Permutations and Combinations ## Permutation - Is associated with arranging things in a different order. - The order of things matters. ### Simple Example If you have 3 letters A, B, C, and you order them like this: ABC, ACB, BCA. So now you have 3 permutations. Because order is important, ABC, ACB, and BCA are different things for permutations. ### Simple Example 2 If you have the letters: A, B, C, D, and I want you to give me how many different ways you can arrange 2 of the four letters? - You can make a list for possible arrangements like this: AB, AC, AD, BA, BC, BD, CA, CB, CD, DA, DB, DC. - *Note*: You can't duplicate things when you try to arrange letters, like AA, BB, CC, or DD. These are not possible arrangements. - Now count our list of arrangements, you will find 12. ### Math rule Now you can see that finding a permutation will consume more time, if the question is more complex, like: find different ways to arrange 3 letters of the 26 letters...
, you will find 12. ### Math rule Now you can see that finding a permutation will consume more

Полный текст и комментарии »

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

136.
Автор luosw, история, 6 лет назад, По-английски
CarYon — An OI/ACM Contest Test Case Generator based on C++ # CarYon: An OI/ACM Contest Test Data Generator based on C++ ![img](https://img.shields.io/badge/Avatar-luosw-red.svg) ![img](https://img.shields.io/github/package-json/v/luosiwei-cmd/caryon) ![img](https://img.shields.io/npm/dm/datamaker-caryon) ![img](https://img.shields.io/npm/dt/datamaker-caryon) ![img](https://img.shields.io/npm/l/datamaker-caryon) ![img](https://img.shields.io/npm/v/datamaker-caryon) # Front Have you ever encountered the following problems when holding a self-contained OI match: - Want to quickly produce a paragraph of text? - Want to quickly perform mathematical operations to generate data? - Want to generate test data one by one without using freopen? - Want to generate a set of random data or series? - Quickly generate data to match the two programs? Then, you can use CarYon and C++ to quickly generate data. Previously supported features are: - Randomly generate a chapter, some words, some words - Get out of the limitation of RAND_MA...
basic operations below are to include the header file `caryon.h` . Note that the header file must

Полный текст и комментарии »

  • Проголосовать: нравится
  • +35
  • Проголосовать: не нравится

137.
Автор beka00, история, 9 лет назад, По-английски
An awesome list for competitive programming! This is a project I started from late January 2016. My motive is that: Although there's fantastic information out there, I think they're still spread all over the place. Therefore, in my opinion it would probably be cool if there's an awesome list for competitive programming! ( It's now featured on the main list! ) I'm actively updating the list here: https://github.com/lnishan/awesome-competitive-programming Awesome Competitive Programming Awesome A curated list of awesome Competitive Programming, Algorithm and Data Structure resources. Created with a view to connecting people to information, this list below contains a complete collection of all the fantastic resources I've collected over the course of my 11-year competitive programming career. I hope you'll find it useful :) What is competitive programming? — Quora Contributing Please kindly follow CONTRIBUTING.md to get started. You can also contribute by sharing! Share the list with your classmates, your friends and eve...
blog with in-depth, illustrated tutorials on basic algorithms and data structures. ★★☆ Competitive

Полный текст и комментарии »

  • Проголосовать: нравится
  • -30
  • Проголосовать: не нравится

138.
Автор I_Love_Fatemeh_misadeghi, 12 лет назад, По-английски
If you ask me how to improve your algorithm competition skill, I will give you the link of this blog. In recent one year, I don't know why, but there are many people send messages to me for asking similar problems. So I decide to create this blog. In the beginning, I must to say, you may feel disappointed after reading this blog. Because I don't have any special tips. My study method waste many many time. There are some basic points I think you have known. Practice, practice, and practice. I take so many time to think and solve problems. I think I do it 5 hours in a day on average. Make friends with many awesome people. I know many awesome people. For example, arosusti, kelvin, peter50216(0O0o00OO0Oo0o0Oo), seanwu, Shik, takaramono, tmt514, ... If I have some problems that I can't solve in few weeks, I can almost get solution from my friends. Then I say what I do for training myself. When I do problems. There are two possible order for choosing problem. Start from most people solved one. Solve consecutive Numbers of problems and try to solve all of...
many many time. There are some basic points I think you have known. Practice, practice, and

Полный текст и комментарии »

  • Проголосовать: нравится
  • -30
  • Проголосовать: не нравится

139.
Автор Maaxle, 3 года назад, По-английски
CSES Range Queries solutions Hey Codeforeces! How are y'all doing? I was solving the CSES Range Queries module and thought of sharing my solutions with you if it's of any use. This blog entry is motivated by [user:kartik8800,2024-04-05]'s own entry ([https://codeforces.me/blog/entry/77128](https://codeforces.me/blog/entry/77128)). I noticed it was missing some of the last problems of the list, so I thought of adding those here as well. This is my first blog entry, so don't mind to correct me if you notice anything odd in here. If you have any alternative solutions to these problems, it'd be great to share them as well! Static Range Sum Queries ------------------ Given an array, answer $q \leq 2\cdot10^5$ queries consisting on the sum of values in the subarray $[l, r]$. Let's obtain the answer of a single query from the precalculated sum of every prefix in the array. This technique is called **prefix sum**. This approach allows us to answer each query in $O(1)$. <spoiler summary="How to obtain the a...
problems afterwards that will require the use of Lazy Propagation. A BIT, in verybasic terms

Полный текст и комментарии »

  • Проголосовать: нравится
  • +6
  • Проголосовать: не нравится

140.
Автор FirstImpression, 8 дней назад, По-английски
A way to explain SAM (Suffix Automaton)? Hey guys, If you've ever tried learning Suffix Automaton (SAM), you probably know how painful it is to wrap your head around. I want to try explaining it from a different angle here. > **Note:** Some math terms and symbols in this post may be used loosely to keep things simple. --- ## 1. Basic definitions Take two different strings $A$ and $B$ in $\Sigma^*$. We write $A < B$ (or $B > A$) if $A$ is a proper suffix of $B$. That means $A$ is a suffix of $B$ and $|A| < |B|$. *Examples:* `"bc" < "abc"`; `"a" < "aaa"`. Now let $F$ be a non-empty set of distinct strings that includes the empty string $\varepsilon$. Every non-empty string $A \in F$ has at least one "smaller" string in $F$ (since $\varepsilon \in F$). Call $\text{Par}(A)$ the parent (immediate predecessor) of $A$. It is the longest string in $F$ that is smaller than $A$. In other words, $A > \text{Par}(A)$, and no $A' \in F$ satisfies $A > A' > \text{Par}(A)$. *Example:* Let $F_1 = \lbrace\varepsilon, \t...
:** Some math terms and symbols in this post may be used loosely to keep things simple. --- ## 1

Полный текст и комментарии »

  • Проголосовать: нравится
  • +118
  • Проголосовать: не нравится

141.
Автор arefin_hossain, история, 5 лет назад, По-английски
Newbie best notes Language using with: C ---------------------- 1. Datatype [resource](https://www.tutorialspoint.com/cprogramming/c_data_types.htm) 2. BASIC OF VARIABLE & CONSTANT [resource](https://www.programiz.com/c-programming/c-variables-constants) 3. OPERATOR [resource](https://www.geeksforgeeks.org/operators-c-c/) 4. TYPECASTING [resource](https://bncodeing.com/what-is-type-casting/) 5. LIBRARY-FUNCTION [resource](https://www.javatpoint.com/functions-in-c) 6. RELATIONAL AND- LOGICAL OPERATORS [resource](https://www.tutorialspoint.com/relational-and-logical-operators-in-c) 7. IF-ELSE STATEMENT [resource](https://www.sattacademy.com/cprogramming/c-if-else-statement.php) 8. TYPE-CASTING [resource](https://www.sattacademy.com/CPROGRAMMING/C-TYPE-CASTING.PHP) 9. POST & PRE-INCREMENT [resource](https://technotip.com/6475/POST-INCREMENT-AND-PRE-INCREMENT-OPERATOR-C-PROGRAM/) 10. TERNARY-OPERATOR [resource](https://www.knowprogram.com/C-PROGRAMMING/CONDITIONAL-OPERATOR-IN-C/) 11. P...
://www.tutorialspoint.com/cprogramming/c_data_types.htm) 2. BASIC OF VARIABLE & CONSTANT [resource](https

Полный текст и комментарии »

  • Проголосовать: нравится
  • -63
  • Проголосовать: не нравится

142.
Автор Mitpro, 11 месяцев назад, По-английски
My first Div. 4 contest Editorial I am very sorry for problem F, and M, solution for them are wrong, F is fixed, but M is not I hope you enjoyed the contest! Thank you for participating! This is my first round on Codeforces, so there might be many mistakes, I would be happy to hear your feedback in the comments. ### [663295A &mdash; Jack and time](https://codeforces.me/contests/663295/problem/A) Approach: [user:Mitpro,2025-05-26] <spoiler summary="Hint"> <spoiler summary="Hint1"> What is the number seconds in $1$ hour and $1$ minute? </spoiler> <spoiler summary="Hint2"> Try using $\bmod$ operator and $\div$ operator </spoiler> </spoiler> <spoiler summary="Editorial"> ### [663295A &mdash; Jack and time](https://codeforces.me/contests/663295/problem/A) This problem is a straightforward one involving conversion of total seconds into hours, minutes, and seconds. We know: - 1 hour = 3600 seconds - 1 minute = 60 seconds So the conversion goes as: let $s$ be the seconds, $hours =...
](https://codeforces.me/contests/663295/problem/D) This is a math problem involving finding the

Полный текст и комментарии »

  • Проголосовать: нравится
  • +32
  • Проголосовать: не нравится

143.
Автор Ahmed_Mohamed_Al3adl, история, 19 месяцев назад, По-английски
Intro to Set Theory # Set theory ## Set - Collection of objects - Set objects called `elements` or `members` - Set elements can be anything: numbers, words, objects, or other sets. - Set elements can be a mix of several types. - Set elements are unique; so the set of `{1,2,2}` is the same set of `{1,2}`. - Set elements are unordered; so the set of `{1,3,2}` is the same set of `{3,1,2}`. - Set is denoted by a capital letter, often italicized as *A*, *B*, and so on. ### Defining Sets #### Restor notation - It's a way to define a set by listing its elements inside curly braces. - Can be inconvenient for large sets. - We can abbreviate large numeric sets that have a clear, unambiguous pattern, like: `{1,2,3, ..., 998, 999, 1000}`. - We can use the ellipsis character (`...`) to say that this set will continue forever, with its clear, unambiguous pattern, like: `{1,2,3,4, ...}` or `{..., -3,-2,-1,0}` or `{..., -2,-1,0,1,2, ...}`. - The sets with will known fixed elements called: **Finit...
)| = 2 ^ {|S|}$ ###### How do we get the math rule for calculating the number of subsets of a set

Полный текст и комментарии »

  • Проголосовать: нравится
  • -24
  • Проголосовать: не нравится

144.
Автор vish, 16 лет назад, По-английски
Blog collection <p>________________________________________________________________________________________<br><br></p><h3><b>Puzzle</b></h3><ul><li><a href="http://codeforces.me/blog/entry/66">Red and Black hair</a>, </li><li><a href="http://codeforces.me/blog/entry/112">The 12 chairs and diamonds</a></li><li><a href="http://codeforces.me/blog/entry/228">Monty Hall Problem</a></li></ul><br><br><h3>Useful <br></h3><ul><li><a href="http://codeforces.me/blog/entry/70">Petr Mitrichev, 3 days in Sao Paulo Training Camp 2010</a></li><li><a href="http://codeforces.me/blog/entry/512">Useful links</a></li><li><a href="http://codeforces.me/blog/entry/529">Problem Set Analysis Of CodeForces</a></li><li><a href="http://codeforces.me/blog/entry/546">Discussions Of CodeForces Round</a></li><li><a href="http://codeforces.me/blog/entry/1492">ALL CodeForces rounds Tutorial</a></li><li><a href="http://codeforces.me/blog/entry/1534">Online Judge Locator</a></li><li><a href="http://codeforces.me/blog/entry/170...
://codeforces.com/blog/entry/619">Basic Binary Indexed Tree * , >Basic Binary Indexed Tree <http://codeforces.me/blog/entry/619> *

Полный текст и комментарии »

  • Проголосовать: нравится
  • +4
  • Проголосовать: не нравится