You can use several words in query to find by all of them at the same time. In addition, if you are lucky search understands word forms and some synonyms. It supports search by title and author. Examples:

  • 305 — search for 305, most probably it will find blogs about the Round 305
  • andrew stankevich contests — search for words "andrew", "stankevich" and "contests" at the same time
  • user:mikemirzayanov title:testlib — search containing "testlib" in title by MikeMirzayanov
  • "vk cup" — use quotes to find phrase as is
  • title:educational — search in title

Results

1.

Solution

Last visit:  12 years ago
Registered:  12 years ago
2.
By Rhodoks, history, 4 years ago, In English
Codeforces Round #810 Editorial Sorry for the late editorial. May this editorial help you. If you have questions, feel free to ask. [problem:1711A] <spoiler summary="hint1."> The minimal weight is at least $1$ since $1$ divides any integer (so $1$ divides $p_1$). </spoiler> <spoiler summary="solution"> Since $k+1$ does not divide $k$, a permutation with weight equal to $1$ is: $[n,1,2,\cdots,n-1]$. </spoiler> <spoiler summary="code"> ~~~~~ #include <bits/stdc++.h> using namespace std; void work() { int n; cin>>n; cout<<n<<' '; for (int i=1;i<n;i++) cout<<i<<' '; cout<<endl; } int main() { int casenum=1; cin>>casenum; for (int testcase=1;testcase<=casenum;testcase++) work(); return 0; } ~~~~~ </spoiler> [problem:1711B] <spoiler summary="hint1."> See the party as a graph. </spoiler> <spoiler summary="hint2."> Divide the vertices into two categories according to their degrees' parity. </spoiler> <spoiler summary="solution"> Let's consider ...
Define $cnt_{i_1 i_2 i_3}$ as:, Knowing the above facts, it is clear that we can apply binary search, Let's call position $j$ a key position if it is the center position, Let's consider the case where $m$ is odd only, since if $m$ is even, Let's consider the interval in the order of its length (small to, Let's first prove hint1 first., Since $k+1$ does not divide $k$, a permutation with weight equal to, $ divides any integer (so $1$ divides $p_1$). Since $k+1, Thus, an optimal solution either has $(x, y) = (0, 1)$ or $(x, y) = (2, 0)$ and the two vertices

Full text and comments »

  • Vote: I like it
  • +3132
  • Vote: I do not like it

3.
By YouKn0wWho, 5 years ago, In English
Codeforces Round #752 #### UPD: (28 April, 2022) <spoiler summary="Donated Finally"> Details: [here](https://codeforces.me/blog/entry/96333?#comment-907470) </spoiler> আবার চলে এসেছি! (That's Bengali for "I am back! (in Terminator mode)") I am super excited to invite you to participate in [contest:1603] and [contest:1604] which will be held on [contest_time:1604]. This round is rated for both divisions. You will be given $6$ problems in each division and $2$ hours to solve them. All the problems are authored and prepared by me. I would like to thank - - [user:antontrygubO_o,2021-10-26] for his breathtaking(<strike>literally</strike>) coordination of the round. <i style="color:White;"> no funny text this time</i> - [user:Alpha_Q,2021-10-26], [user:Anachor,2021-10-26] and [user:antontrygubO_o,2021-10-26] for putting up with my dumb ranting and helping with the problems. - [user:Um_nik,2021-10-26], [user:gamegame,2021-10-26], [user:kefaa2,2021-10-26], [user:dorijanlendvaj,2021-10-26], [u...

Full text and comments »

  • Vote: I like it
  • +3156
  • Vote: I do not like it

4.
By Una_Shem, 5 years ago, In English
AlphaCode (DeepMind) Solves Programming Problems on Codeforces <img src="/predownloaded/99/08/99083f12762004fb2f7278177262dd577e3f19cd.png" style="float:right; width:300px; margin:0;"/> Hello, community. Today DeepMind announced a new achievement of AI. And it is directly related to what we love &mdash; programming problems. They have developed AI capable of solving some competitive programming problems! The future has arrived. You should read solutions of [user:SelectorUnlimited,2022-02-02], [user:WaggleCollide,2022-02-02], and [user:AngularNumeric,2022-02-02] solutions. All solutions are written automatically. The only input for writing solutions is a problem statement in English. Details can be read at the link https://deepmind.com/blog/article/Competitive-programming-with-AlphaCode Apparently, if these accounts would take part in real competitions, then their rating would be about 1300. <center> <img src="https://i.blogs.es/a2119c/terminator-2/1366_2000.jpg" style="width:450px;"/><br> <small>Terminator is ready to take p...

Full text and comments »

  • Vote: I like it
  • +3037
  • Vote: I do not like it

5.
By MikeMirzayanov, history, 2 years ago, In English
Rule Restricting the Use of AI [revision 2024-09-14] It seems that neural networks are working technological wonders. Not long ago, they struggled with even the simplest tasks in our competitions, but now they are reaching new heights that cannot be overlooked. There is reason to believe that progress will continue, and we can expect further advancements in neural networks within the realm of programming competitions. For this reason, we are explicitly limiting the use of AI-based systems (such as various models like GPT, Gemini, Gemma, Llama, Claude, and others) for solving programming problems. However, we recognize that AI can be a valuable tool for learning and coding assistance, so we aim to establish clear boundaries for its use. **Application of this Rule:**<br/>This rule applies strictly to in-contest participation. This includes both registered contestants and out-of-competition participants in any rated Codeforces round. If a round is unrated and this is explicitly stated in the round announcement or rules, the rul...
language descriptions of the solution. * You are forbidden from using AI to diagnose or resolve, -based system to receive ready-made code or natural language descriptions of the solution., . * Relying on AI to generate algorithmic logic or the key solution is strictly prohibited. * If you're

Full text and comments »

  • Vote: I like it
  • +2558
  • Vote: I do not like it

6.
By MikeMirzayanov, 3 weeks ago, In English
Codeforces Round 1134 (Div. 4) Hello Codeforces! I am glad to invite you to [contest:2290], which will take place on [contest_time:2290]. After quite a long break, I have taken up problem setting again — this time working together with AI agents. For me, this is an experiment in getting back into problem writing, and we will see together how successful AI turns out to be as a partner in this work. I am looking forward to seeing both Div. 4 participants competing officially and everyone else joining out of competition! <div style="height:1em;"></div> <spoiler summary="Why I decided to author this round (a bit of lyrics and rambling)"> Yes, I am dictating these words into my phone right now, to put them into shape for you a bit later. We live in an amazing time when so many things are changing. I have been programming for more than 25 years now, and throughout almost all of this time I wrote code every day and solved problems every day. At first, these were mostly programming contest problems — ...
differ slightly in performance from the official ones, so the rule is this: if asolution runs within, : if a solution runs within one fifth of the time limit (TL/5) on every test, we trust that its

Full text and comments »

  • Vote: I like it
  • +2339
  • Vote: I do not like it

7.
By BledDest, 3 years ago, In English
I don't want this to get normalized I don't think comments like "you use X in model solution, author, are you an idiot?", "f**k you and your problems, they are shit" and such should be normal on Codeforces, especially when written by someone high-rated and/or respected in the community. I also don't think this kind of behavior should be normal towards regular users. I know that sometimes contests can be frustrating. Sometimes it is the participant's fault, sometimes it is the problemsetter's fault, sometimes it just happens without anyone being guilty of that. And I understand that in some cases, the criticism the author receives is fair and well-deserved. But there is a fine line between criticism, saying that you didn't like the problems, and hurling insults against the author. The former two are acceptable (and sometimes even needed, because authors have to improve and learn from their mistakes); the latter one, in my opinion, should not be acceptable. It's not like we can ever get rid of offense and hatred ...
because of some details of the solution). I wanted to show it as a clear example, but it was not the, I don't think comments like "you use X in model solution, author, are you an idiot?", "f**k you and

Full text and comments »

  • Vote: I like it
  • +2126
  • Vote: I do not like it

8.
By maomao90, history, 3 years ago, In English
Hello 2024 Hello Codeforces, We are very glad to invite you to participate in [contest:1919], which will start on [contest_time:1919]. You will be given **8 problems** and **2.5 hours** to solve them. One of the problems will be divided into two subtasks. The round will be rated for everyone. There will be at most 2024 interactive problems, so please read the [guide for interactive problems](https://codeforces.me/blog/entry/45307) before the contest. All the problems are written and prepared by me. <spoiler summary="Spoiler"> The first tester tested on 10 October **2022**. </spoiler> We would like to give our sincere thanks to: - [user:errorgorn,2024-01-02] for his wonderful coordination! - [user:Alexdat2000,2024-01-02] for translating problem statements. - [user:dario2994,2024-01-02] for coming up with the solution to one of the problems. - [user:conqueror_of_tourist,2024-01-02], [user:iLoveIOI,2024-01-02], [user:Um_nik,2024-01-02], [user:oolimry,2024-01-02], [user:thenymphs...
translating problem statements. - [user:dario2994,2024-01-02] for coming up with thesolution to, -01-02] for coming up with the solution to one of the problems. - [user:conqueror_of_tourist,2024-01

Full text and comments »

Announcement of Hello 2024
  • Vote: I like it
  • +2422
  • Vote: I do not like it

9.
By Monogon, history, 7 years ago, In English
Codeforces Round #639 Hello, Codeforces! I'm very glad to invite you to [contest:1344] and [contest:1345]. This contest will take place on [contest_time:1344]. In both divisions, you will have **2 hours 15 minutes** to solve **6 problems**. The score distribution will be announced closer to the start of the contest. Of course, this round would not be possible without the help of many people, who I'd like to thank: - [user:isaf27,2020-05-01], for coordinating this round, and helping with solution ideas. - My ICPC teammates [user:Kuroni,2020-05-01] and [user:strongoier,2020-05-01], and coach [user:cn355,2020-05-01], for encouraging me to pursue competitive programming. In particular, I'd like to thank [user:Kuroni,2020-05-01] for being so spectacularly bad that a barely-orange user like myself actually has a place on our team. - [user:300iq,2020-05-01], [user:antontrygubO_o,2020-05-01], [user:Ari,2020-05-01], [user:ffao,2020-05-01], [user:fpc_coder,2020-05-01], [user:gamegame,2020-05-01], [user:Kur...
thank: - [user:isaf27,2020-05-01], for coordinating this round, and helping withsolution ideas, - [user:isaf27,2020-05-01], for coordinating this round, and helping with solution ideas. - My

Full text and comments »

  • Vote: I like it
  • +2313
  • Vote: I do not like it

10.
By maspy, history, 4 months ago, In English
0 Problems Remaining [日本語記事(For Japanese Speakers)](https://maspypy.com/codeforces-all-ac) ---- Previous post: https://codeforces.me/blog/entry/150057 Submission: [submission:384239819] 2026/07/26 03:13:42 JST (2026/07/25 18:13:42 UTC) I have solved every problem in the Codeforces PROBLEMSET except for those for which I determined that obtaining an accepted verdict is impossible. ![unsolved problem list](https://maspypy.com/wp-content/uploads/2026/07/problemset.png) # Scope I considered the problems listed in the [PROBLEMSET](https://codeforces.me/problemset). I have solved very few problems from the [GYM](https://codeforces.me/gyms). The only collection I worked through systematically was the PROBLEMSET. I determined that it is theoretically impossible to obtain an accepted verdict for the following 31 problems: [problem:775A], ([92101](https://codeforces.me/problemset/problem/921/01) ... [92114](https://codeforces.me/problemset/problem/921/14)), [problem:927A], [prob...
accustomed to spending several days debugging a single solution is unlikely to help very much in an actual, when I read an editorial, I generally tried to understand most of the solution and its proof before, , including copying solution code., For many problems, once I understood the general structure and why the solution should be correct, However, even when I read an editorial, I generally tried to understand most of thesolution and, Recently, I have started organizing solution notes, implementations, my own difficulty ratings

Full text and comments »

  • Vote: I like it
  • +1749
  • Vote: I do not like it

11.
By MikeMirzayanov, 9 years ago, translation, In English
New: Diagnostics of Solutions in C++ <img src = "/predownloaded/b5/d2/b5d246ffc32dfe82c3cbac77d1898c5fcb62fa57.jpg" style = "float: right; margin: 0 1em 1em 1em;"/> Hello! I am pleased to report that two rounds of Codeforces have gone quite well in terms of the work of Codeforces, I am very glad about it. These <s>days</s> nights I spent in a profiler, fixing the code, researching the settings of MariaDB. In addition, I managed to allocate several hours on Sunday (to be honest, until Monday morning) to finish the long-planned innovation. Meet, diagnostics of solutions in C++! Many Codeforces visitors are already tired of the questions of less experienced participants: "Why does my solution not work on some test on the Codeforces servers, if I locally launch it and it works correctly? You have the wrong compiler/servers!" In 99% of cases this is an example of <a href ="https://en.wikipedia.org/wiki/Undefined_behavior">undefined behavior</a> in a program. In other words, the program contains mistakes that, du...
does my solution not work on some test on the Codeforces servers, if I locally launch it and it, tired of the questions of less experienced participants: "Why does my solution not work on some test, If your solution:

Full text and comments »

  • Vote: I like it
  • +1719
  • Vote: I do not like it

12.
By MikeMirzayanov, 7 years ago, In English
Codeforces: С++17 64bit Support Hello, Codeforces. I hope you wash your hands and feel great. I added the support of 64-bit g++. If you are using Windows, you can easily install it via our minimalistic package manager [PBOX](http://pbox.me/) running the command line `pbox install msys2-mingw64-9`. Your solutions are compiled with the command line `g++ -static -DONLINE_JUDGE -Wl,--stack=268435456 -O2 -std=c++17 program.cpp`. Now you can try to use int128 and other 64-bit specific features! In fact, I am slightly worried that the presence of such features may widen the gap between C ++ and other languages. Wait and see. Currently, support for 64-bit C++ is experimental. For example, I would not be surprised if IO on it works slower in some cases (it is necessary to test!). I invite you to join the testing and experimentations. Share your impressions in the comments!

Full text and comments »

  • Vote: I like it
  • +2511
  • Vote: I do not like it

13.
By SecondThread, history, 6 years ago, In English
Algorithms Thread 8: Tree Basics (+ Gym Contest) Algorithms Thread Episode 8: Tree Basics ================== Episode 8 of Algorithms Thread [comes out in <90 minutes!](https://youtu.be/MOy4UDjN8DM) This one is a bit more beginner-friendly and covers the following ideas: - Graph/Tree Diameters - Binary Lifting - Tree Flattening with Euler tours Also, to make sure you have actually learned that stuff, I made a [custom Gym set on CodeForces](https://codeforces.me/gym/102694) that will last two weeks that hopefully is really good practice for making sure you have learned this stuff. Here is a link to the gym set; it will be available 45 minutes after the video comes out so that people have time to watch the video before starting the set, if they are interested in penalty points. All of the problems in the gym are original to this set (in their flavortext at least, some are simple enough that I'm sure they have appeared in other contests before). The new gym integration was heavily inspired by [user:Errichto,2020-08-16]'s ...

Full text and comments »

  • Vote: I like it
  • +1924
  • Vote: I do not like it

14.
By MikeMirzayanov, 5 years ago, In English
Goodbye 2021. Hello 2022! <img src="/predownloaded/f4/1f/f41ff0beb745fb2f84a55d9f2cc451273efc6267.jpg" style="width:300px; float:right; margin: 0 1em 1em 1em"/> Hello Codeforces! Oh yes, 2021 ends! I recently realized that 2022 is pronounced like "2020 too". Not that. I want a completely different year! Anyway, we did a nice job this year. I hope we have pleased you with interesting problems. Thanks to the round coordinators and writers! You make our community richer. Please make us happy in 2022! I wish you all interesting tasks and brilliant solutions! I wish you error-free code and wish us only rated rounds :-) Hello, 2022! And we have traditional gifts! #### <img src="https://assets.codeforces.com/images/wand.png"/> Change Handle Feature Hurry! Only until the 10th of January, you can change your handle (<b>but only once</b>)! Note that it will be possible to roll back the changes or change the handle again only _after a year_. Be careful what you wish for. You can change your han...

Full text and comments »

  • Vote: I like it
  • +1867
  • Vote: I do not like it

15.
By MikeMirzayanov, 3 years ago, In English
Codeforces: Results of 2023 [Annual Report] Hello, Codeforces. Let's recall 2023, shall we? In this post, I want to summarize this year. You know, a lot of terrible things happen in the world, and personally, this year was the hardest and most sorrowful for me. But today, we'll remember something else. We'll remember what this year was like for Codeforces. Recently, Codeforces turned 14 years old. Not bad, right? And for many years now, when asked "What is Codeforces?" the first thing I say is — it's a community! [cut]<br/> #### Personal Thanks! On behalf of the community (and myself), I say thank you to everyone who tries, helps, and makes efforts to keep the community alive. Thank you to the developers! Although I continue to engage in development and other technical activities, I'm glad that these guys made an effort and improved the platform: [user:geranazavr555,2024-02-04], [user:unreal.eugene,2024-02-04], [user:vbandurin,2024-02-04], [user:ChurakovaAlexandra,2024-02-04], [user:medvezhonokok,2024-02-04]...
* Introduction of Testsets and Groups in stress testing * Automatic assignment ofsolution tags after, testing * Automatic assignment of solution tags after solution execution * Several API improvements

Full text and comments »

  • Vote: I like it
  • +1748
  • Vote: I do not like it

16.
By Radewoosh, history, 8 years ago, In English
Blogewoosh #1 Hello, codeforces! The community wants so the community gets it! :D Here it is, my very first blog about tasks and algorithms. At the beginning I've decided to post my entries on codeforces, maybe I'll switch to something different if it becomes uncomfortable. To pour the first blood I decided to choose a task from one of the old ONTAK camps. Task's name is "different words" ([you can submit here](https://szkopul.edu.pl/problemset/problem/wTy-sxQCIKry0Ml-6RvM0L78/site/?key=statement)). The statement goes as follows: You are given $n$ words ($2 \leq n \leq 50\,000$), every of length exactly $5$ characters. Each character can be a lowercase letter, an uppercase letter, a digit, a comma... basically, it can be any character with ASCII code between $48$ and $122$ (let's say that $k$ is the number of possible characters). A task is to find all pairs of indexes of words which are $\textbf{really different}$. Two words are $\textbf{really different}$ if they differ at all $5$ corres...
some way, but I won't go deeply into this solution, cause it isn't interesting and $k$ is of course, , but I won't go deeply into this solution, cause it isn't interesting and $k$ is of course bigger

Full text and comments »

  • Vote: I like it
  • +1799
  • Vote: I do not like it

17.
By Error_Yuan, history, 3 years ago, In English
Goodbye 74TrAkToR + Problem A~E: The problems themselves are good and typical A~E. Indeed I like problem D. The pretest for A is a bit weak, and it's not a big problem yet. + Problem F: The problem has an origin. :) See the link: [click](https://www.luogu.com.cn/problem/P9394). The problem in contest is only a weakened version of the one in Luogu. + Problem G: It's said that our great coordinator had not proved the time complexity of the intended solution is correct :) If the authors did, please share it in the editorial. (although this problem is completely beyond my ability :) ) + Problem H: Oh dear [user:74TrAkToR,2023-12-30], could you please OEIS the sequence before you use the "several-integer-input" problem in rounds next time? Anyone who copied the first example and opened [https://oeis.org/A286331](https://oeis.org/A286331) could quickly get the formula. And the problem itself is not so hard imo. Anyway, it should not be used in contest, especially for the last problem. For me pers...
find the error in the intended solution. Votes of the announcement: $-628$., intended solution is correct :) If the authors did, please share it in the editorial. (although this, proved the time complexity of the intended solution is correct :) If the authors did, please share it, with intended solution in O(n log n) :) + ... (please take a look at Edit 6)

Full text and comments »

  • Vote: I like it
  • +1597
  • Vote: I do not like it

18.
By awoo, history, 5 years ago, translation, In English
Educational Codeforces Round 121 [Rated for Div. 2] Hello Codeforces! On [contest_time:1626] [contest:1626] will start. Series of Educational Rounds continue being held as [Harbour.Space University](https://harbour.space/) initiative! You can read the details about the cooperation between [Harbour.Space University](https://harbour.space/) and Codeforces in the <a href="http://codeforces.me/blog/entry/51208">blog post</a>. This round will be **rated for the participants with rating lower than 2100**. It will be held on extended ICPC rules. The penalty for each incorrect submission until the submission with a full solution is 10 minutes. After the end of the contest you will have 12 hours to hack any solution you want. You will have access to copy any solution and test it locally. You will be given **6 or 7 problems** and **2 hours** to solve them. The problems were invented and prepared by Adilbek [user:adedalic,2022-01-15] Dalabaev, Vladimir [user:vovuh,2022-01-15] Petrov, Ivan [user:BledDest,2022-01-15] Androsov, Mak...
rules. The penalty for each incorrect submission until the submission with a fullsolution is 10, solution is 10 minutes. After the end of the contest you will have 12 hours to hack anysolution you want

Full text and comments »

  • Vote: I like it
  • +1670
  • Vote: I do not like it

19.
By Ari, history, 6 years ago, In English
On Problems vs. Questions in Competitive Programming: My solution _TL;DR: The most reasonable solution to the problems vs. questions debate is to use none of the currently accepted terms._ As we have seen many times, particularly over the past few days, the task of assigning a label to the activities we perform as competitive programmers is a bigger problem than one might think at first. Time and time again we have seen people questioning what we should call our activities, often to the point of eliciting some rather harsh responses. To give some context to this discussion, I will focus on two of the terms that members of the community have adopted over the years, _problems_ and _questions_. (Sorry task lovers! You have some fine points for sure, we frequently talk about subtasks rather than subproblems or subquestions after all :P). All quotations here are posted anonymously, but if you want to claim ownership of one of them or have one removed, just tell me. If you are familiar with the arguments, feel free to skip to the final section of the...
On Problems vs. Questions in Competitive Programming: My solution, rather call it a solution than an answer., **The solution**, _TL;DR: The most reasonable solution to the problems vs. questions debate is to use none of the

Full text and comments »

  • Vote: I like it
  • +1178
  • Vote: I do not like it

20.
By rng_58, history, 6 years ago, In English
AtCoder Library Recently, the number of algorithms and data structures we use in competitive programming are rapidly growing. It's a nice thing: by using more algorithms, the variety of possible problems gets wider, and we can enjoy more problems. On the other hand, before reaching adhoc, thinking-oriented part of this competition, we have to spend more and more time to learn algorithms. Sometimes a problem asks matching on general graphs; you have to find a paper describing it, read it, and implement its really complicated algorithm. Or sometimes you have to spend time tuning your library by a constant factor. Or sometimes you use multiple pre-written codes together, the variable names collide, and get annoyed. Until now, I basically rejected all problems that require pre-written codes of complicated algorithms because I don't like these things. For example, we never used segment trees with lazy propagation in our contests. However this way we can't use otherwise interesting problems and it ...
requires that library, so the solution should be..."., solution should be...". Now we have two questions for the community: - The first version of ACL

Full text and comments »

  • Vote: I like it
  • +1385
  • Vote: I do not like it

21.
By 244mhq, history, 11 months ago, In English
Please try to be more positive in your feedback on the rounds. Hi, a few disclaimers first. 1. I work as a coordinator on CF, but this blog is solely my initiative (I didn't tell anyone from CF about it). 2. I was a few times in the author role, so I think that I have the right to speak on behalf of both authors and coordinators. Obviously, it doesn't mean that all authors/coordinators think the same, but (based on discussion with some people) I think that my opinion is not unpopular. Main point of this blog — I feel like our community is becoming much more aggressive towards any things (some of which I can't even call issues) that they don't like during the round. I don't think it's a good direction, and I think it can decrease the motivation of authors & coordinators to do more rounds. Now I will explain why I think so. Obviously, you might guess that this blog was inspired by yesterday's round, but also a few recent ones too (for instance, CF 1069, CF 1058). The first thing that any person will see on the home page now is that...

Full text and comments »

  • Vote: I like it
  • +1436
  • Vote: I do not like it

22.
By -is-this-fft-, history, 5 years ago, In English
Self-deception: maybe why you're still grey after practicing every day I generally don't like to give much advice on "how to practice", but recently I have been thinking a lot about this and I realized that there is something that I believe affects a lot of people (though it is admittedly hard to tell) that barely gets talked about: self-deception. Self-deception is a devious thing. It can be very hard to detect, yet can be fatal to improvement. This blog is mainly directed to greys, greens and cyans that can't get out of these categories. Most examples are given with that in mind. That being said, I believe others have something to think about as well. This is my first blog on such "psychological issues" and I don't know if I'll ever make another one. It's certainly a difficult topic to write about because for most of the blog, the message is "your practice is not as good as you think it is" or even "you aren't as good as you think you are" which can of course be a hard thing to hear. Thus, I have to somehow be very gentle while getting the poin...
problem until the end. Yes, a couple of times I searched for a solution, but only as an emergency. Do not, terminology: at least in this blog, "solve" means "come up with the solution (and possibly, implement, A quick note about terminology: at least in this blog, "solve" means "come up with thesolution, An example from a recent contest: the solution to [problem:1617C] mentions this fact: $x \, \mathrm, What's the solution here? Remember, the best practice method is any reasonable method that doesn't

Full text and comments »

  • Vote: I like it
  • +1292
  • Vote: I do not like it

23.
By Um_nik, history, 4 years ago, In English
Pro Tips - get them while they are free More tips to use while studying under my tutoring [here](https://um-nik.notion.site/Pro-Tips-8b923b0dc7c94770824bdf4184afc43c). ## Stop caring about the rating Unless there are prizes involved, your position in the standings makes no difference. I can feel awful after winning a contest if I know that I could solve one more problem. Or I can feel OK losing a bunch of rating points knowing that I solved everything I could.  Because rating is just a number. It is highly volatile and it depends on other people, not only on your skill. But solving problems is totally up to you. And you should evaluate yourself not based on some random metric, but on your honest feeling whether you performed up to your expectations. Your sense of self should be under your control, don't get hung up on some imaginary value, you cannot reduce your progress to a single number. ## Don't use more than one account Rating is just a number. Do not be afraid to lose your colour. You’ll get it back in no t...
example of this is guessing solution or complexity from constraints and/or underlying objects. Yes, it is, fit a solution doesn't mean that that solution will be optimal for the problem. You may create the, ## Don't try to create problems that MUST have a specific solution, - Do I understand the problem correctly? - Is my stupid solution definitely stupid? Does it use, - Is the solution doing what it was supposed to do? - Is the problem in the code or in the idea?, If you have a test on which the solution gives wrong answer:, One very special example of this is guessing solution or complexity from constraints and/or, You can still find inspiration anywhere you wish, and starting from a solution is a good way for, solution correct? - Do I understand the problem correctly?

Full text and comments »

  • Vote: I like it
  • +1119
  • Vote: I do not like it

24.
By MikeMirzayanov, 6 years ago, In English
Codeforces New Feature: Rewrite Statements in Mashups Hello Codeforces! There is something new for you. It seems that now it will be easier to reuse problems from the archive for educational and other purposes. As you know, problems from past Codeforces rounds can be added to <a href="https://codeforces.me/blog/entry/10099">mashups</a> simply by their codes of the form like <code>1234D</code> (contest ID + problem letter). I myself regularly used this when I taught at Saratov University &mdash; it was very convenient to prepare trainings: problems have expected complexity and topics, there are Russian and English statements, you can see the analysis and many solutions. Because of hacks and uphacks, problems in the archive usually have strong tests. Almost all of them are well-prepared. In addition, with the help of <a href="https://codeforces.me/blog/entry/21912">user lists</a>, you can easily pick up problems for a group of students that they did not solve. <img src="/predownloaded/2f/ec/2fecbf1f7e7a8f8655f0f74576fd1f6dbbc2307...
cope with the temptation to spy on the solution or tests, then beginners sometimes acted dishonestly. I, majority of adult participants could cope with the temptation to spy on the solution or tests, then

Full text and comments »

  • Vote: I like it
  • +1666
  • Vote: I do not like it

25.
By qwexd, 3 months ago, In English
Codeforces Round 1121 (Div. 2) <div class="problem-statement" style="border:0 !important; padding:0 !important; margin:0.5em !important; box-shadow:none !important;"> <div class="header"> <div class="title">1121. Another Round</div> <div class="time-limit"><div class="property-title">time limit per participant</div> 2 hours</div> <div class="memory-limit"><div class="property-title">memory limit per participant</div> 1 brain</div> </div> <div class="legend"> <p> <i>This is <s>an interactive problem</s> a contest with an <b>unusual start time</b>.</i> </p> <p> You are given a Codeforces account and $n = 6$ problems, authored and prepared by [user:qwexd,2026-09-12] and [user:jeroenodb,2026-09-12]. </p> <p> In one operation, you may choose a problem $i$ ($1 \le i \le n$) and submit a program intended to solve it. </p> <p> The maximum scores are given below. Problem E is divided into two subtasks. </p> <div style="overflow-x:auto; margin:0.5em 0 1em;"> <table style="border-collapse:co...
It has been shown that every problem has a solution. The proofs are now available in the

Full text and comments »

  • Vote: I like it
  • +1304
  • Vote: I do not like it

26.
By MikeMirzayanov, 10 years ago, translation, In English
Codeforces: summing up 2016 year <center> <img src="http://assets.codeforces.com/images/Happy-New-Year-HD-Wallpapers.jpg"/> </center> Somehow it turns out that for me, each coming the New Year means more and more. This is an excellent opportunity to take stock, to breathe fresh air and to go through a kind of catharsis. This is a rare opportunity to be with the family, dress up in Santa Claus and just have fun. Holidays give me a clear criterion that I do the right things. If during the holidays, I begin to think about it, to recall some deferred ideas, eager to implement something new. So I’m doing right things. My things. And now exactly the same as in several recent years: during New Year holidays I write code for Codeforces, trying new technology or simply I’m making minor changes in testlib. It is necessary to me: at this moment are no deadlines, do not press the obligation. Just now, at 3 am, I can not break away from being able to do something new. I would like to take a moment and realize that spun in ...
a solution twice * better syntax highlighting * feature to register again on a virtual contest, tutorials directly from Polygon (in blog posts) * fixed possibility to submit a solution twice

Full text and comments »

  • Vote: I like it
  • +1405
  • Vote: I do not like it

27.
By Radewoosh, history, 8 years ago, In English
Blogewoosh #6 Hello, codeforces! Sorry for the long break, but the last weeks of holidays and the first weeks of academic year took my attention. I hope today's trick will make you forgive me. :P I invented this trick a few years ago, but for sure I wasn't first, and some of you already know it. Let's consider the following **interactive** task. There are $n$ ($1 \leq n \leq 10^5$) hidden integers $a_i$, each of them from range $[1, 10^{18}]$. You are allowed to ask at most $103000$ queries. In one query you can choose two integers $x$ and $y$ ($1 \leq x \leq n, 1 \leq y \leq 10^{18}$) and ask a question ''Is $a_x \geq y$?'' The task is to find the value of the greatest element in the hidden array. The checker **isn't** adaptive. Unfortunately, this task is only theoretical, and you cannot solve it anywhere, but it'll turn out, that solution can be handy in many other, much more complicated problems. [cut] $ $ Even beginners should be able to quickly come up with a solution which ask...
of them at least once). So, maybe let's develop a solution which at least has a chance to do it, solve it anywhere, but it'll turn out, that solution can be handy in many other, much more complicated, , that solution can be handy in many other, much more complicated problems., Even beginners should be able to quickly come up with a solution which asks $n \cdot log(d, OK, nice task, randomized solution, but how could it be useful in other problems? Here's a good, Of course, this solution can do the binary search even $n$ times, for example when the hidden array

Full text and comments »

  • Vote: I like it
  • +1075
  • Vote: I do not like it

28.
By EvenImage, history, 7 years ago, In English
A problem collection of ODE and differential technique ##A problem collection of ODE and differential technique *This problem might be well-known in some countries, but how do other countries learn about such problems if nobody poses them.* For those who are interested in well-known problems in China. Thank [user:Elegia,2020-04-23] and [user:djq_cpp,2020-04-23] for developing this technique. Thank [user:tEMMIE.w.,2020-04-23] for reviewing this article. ####[Chain Reaction](http://uoj.ac/problem/50) in UOJ Round 3 By [user:vfleaking,2020-04-23] **Statement** ​ You are given a set $A$, you need to compute $g_{i} = \frac{1}{2} \sum_{j,k}{i-1 \choose j}{i-1-j \choose k} g_jg_k$ where $i-1-j-k \in A$. **Solution** ​ Let the EGF of $g$ be $x(t)$ and EGF of $A$ be $a(t)$. Thus $x'(t)=\frac{1}{2} a(t) x^2(t)+1$. We can solve this equation by D&C and FFT in $O(n\log^2 n)$. But there is a <s>slower</s> solution in $O(n\log n)$. ​ For a polynomial equation $f(x(t))=0$, we can use the Newton's method to solve it. If we find ...
The intended solution is $O(n\log^2 n)$. This improved solution credits to [user:_rqy,2020-04-23, The intended solution is $O(na^2 \log n)$. This solution credits to [user:djq_cpp,2020-04-23]., This solution credits to [user:djq_cpp,2020-04-23]., can solve this equation by D&C and FFT in $O(n\log^2 n)$. But there is a slower solution in, **Solution**, ](https://www.luogu.com.cn/problemnew/solution/P5373). However, it is a bit slower than $O(n^2)$ one when, } \sum_{j,k}{i-1 \choose j}{i-1-j \choose k} g_jg_k$ where $i-1-j-k \in A$. ** Solution** Let the

Full text and comments »

  • Vote: I like it
  • +1044
  • Vote: I do not like it

29.
By MikeMirzayanov, history, 7 years ago, In English
New: Diagnostics of Solutions in C++ (Better UI) Hello, Do you remember my post <a href="/blog/entry/55902">New: Diagnostics of Solutions in C++</a>? If not, please read it. Recently, I've implemented better UI to show you diagnostics. Now in on the status pages sometimes you can notice something like this: ![ ](/predownloaded/13/b9/13b9e43f515630be3a11de9a4f9141acc5df35fd.png) Click to the ![ ](https://sta.codeforces.com/s/95227/images/icons/attention-16x16.png) and you'll see the code with the highlighted problematic line and description with the possible reason of the mistake. ![ ](/predownloaded/52/7a/527ad11817af463f7c27c224e45c93f3ca306cb0.png) Do you like it?

Full text and comments »

  • Vote: I like it
  • +1754
  • Vote: I do not like it

30.
By Um_nik, history, 5 years ago, In English
How to practice Competitive Programming [Um_nik version] CP is about solving problems fast. And as absurd as it may sound, I believe that <span style="color:blue">SOLVE</span> and <span style="color:red">FAST</span> are very different and almost independent parts, and you need to practice them separately. Let’s look at some <span style="color:red">contest</span>, like a CodeForces round. For the sake of simplicity let’s assume that every problem has some *difficulty*, which is a numerical value denoting how hard it is, bigger values correspond to harder problems (it is not true, but it is an ok-ish approximation, at least if we consider subjective difficulty for a fixed person). Contests are made for a wide range of participants, and problemsetters strive to make contests interesting for a wide range of participants, which means having a *smooth difficulty gradient*. Well... as smooth as it is possible with 5-6 problems. <spoiler summary="Graph 1"> ![ ](https://s3.us-west-2.amazonaws.com/secure.notion-static.com/677e0ae2-a8df-4874-aff...
editorials at all, so you don’t have to fight the urge to look at the solution., reductions and implement the solution, but in a nutshell **you know how to do every small part of the

Full text and comments »

  • Vote: I like it
  • +1117
  • Vote: I do not like it

31.
By antontrygubO_o, 7 years ago, In English
Good Bye 2019 Hello again, Codeforces! We are glad to invite you to <s>Mathforces</s> <s>Thinkforces</s> [Good Bye 2019](https://codeforces.me/contests/1270), which will take place on [contest_time:1270]. Some information about the round: <ul> <li>Rated for all participants!</li> <li>3 hours!</li> <li> <strong> No subtasks! </strong> </li> <li>There will be an <strong> interactive problem </strong> in this round. You can read the guide for interactive problems [here](https://codeforces.me/blog/entry/45307)</li> <li> Editorial will be published right after the system testing </li> </ul> All problems in this round were prepared by us, [user:antontrygubO_o,2019-12-28] and [user:kefaa2,2019-12-28]. We worked on this round for a long time and tried to make all the problems very interesting. We hope that you will enjoy the round! We would like to thank: <ul> <li> [user:arsijo,2019-12-24] for coordination of the round </li> <li> [user:GandalfTheGrey,2019-12-24] fo...
> [user:GandalfTheGrey,2019-12-24] for the idea of solution of one problem * [user:gepardo,2019-12-24] for, ] for the idea of solution of one problem * [user:gepardo,2019-12-24] for useful

Full text and comments »

Announcement of Good Bye 2019
  • Vote: I like it
  • +1517
  • Vote: I do not like it

32.
By tourist, 4 years ago, translation, In English
Codeforces Round #844 (Div. 1 + Div. 2) Hello! Welcome to the [contest:1782] that will start on [contest_time:1782]. It will be a combined rated round for both divisions and open to everyone. This round is a mirror of VK Cup 2022 Elimination — annual programming championship for Russian-speaking competitors organized by VK. VK Cup [started in 2012](https://codeforces.me/vkcup2012) and has grown to be a five-track competition in competitive programming, Mobile, ML, Go, and JavaScript. All the problems are authored and prepared by me. Thanks to [user:KAN,2023-01-13], [user:errorgorn,2023-01-13], [user:lperovskaya,2023-01-13], [user:dario2994,2023-01-15], [user:Monogon,2023-01-15], [user:Arpa,2023-01-15] for making this round better. You will be given 8 problems and 3 hours to solve them. **UPD**: [Editorial](https://codeforces.me/blog/entry/111783) Congratulations to the winners: 1. [user:orzdevinwang,2023-01-24] 2. [user:noimi,2023-01-24] 3. [user:Radewoosh,2023-01-24] 4. [user:gamegame,2023-01-24] ...
accepted solution to problem H2., and to [user:maroonrk,2023-01-24] for getting the only accepted solution to problem H2.

Full text and comments »

  • Vote: I like it
  • +1287
  • Vote: I do not like it

33.
By Um_nik, history, 2 years ago, In English
On AI ruining "solving math problems with computer" You all went crazy. Instead of arguing with every opinion separately, I just want to ask one question: Why are you doing competitive programming? Is it to get to 1600 rating and put it on the resume? If so, please use AI, cheat, and do everything possible to get to 1600 as soon as possible and get the f**k out of this platform. And if you are (not) a normal person and do competitive programming because it is fun to solve problems, do you think it is fun to copy the problem statement into an AI model prompt and then copy the code it spews to submit? And why do you assume that everyone else will do that if there will be such an opportunity? The same goes for cheaters. Yes, some people do not do this as a sport, for fun. Why do you care? I do think that AI is ruining competitive programming. By proxy. And that proxy is all of you who are running around yelling "We will all die, somebody do something about AI". I have seen a couple of comments saying "authors/coordinators must make s...
/entry/101420)? Do you think AI couldn't guess the solution `print(input())`? So, do you want to ban, solution `print(input())`? So, do you want to ban what we collectively agree to be one of the best

Full text and comments »

  • Vote: I like it
  • +1199
  • Vote: I do not like it

34.
By MikeMirzayanov, history, 2 years ago, In English
Welcome GNU G++23 14.2 (64 bit, msys2) <i><b>UPDATE:</b> Some time ago, there was news here that we supported C++23 by installing GCC 14 from the Winlibs project. It turned out that with this method of supporting C++23, some compatibility issues lead to significant performance drops in certain submissions. So, I tried another distribution for GCC 14: the MSYS2 project. It seems that this problem does not occur with it, and now there are no unexpected performance drops. Let's test this C++23 support option together!</i> Hello, Codeforces! Together with [user:Vladosiya,2024-08-22], we've added support for the 64-bit g++14 C++23. You can find it under the name `GNU G++23 14.2 (64 bit, msys2)`. If you're using Windows, you can easily install it via our minimalistic package manager, PBOX, by running the command `pbox install gcc14-64-msys2`. Thanks to the MSYS2 project! We used the distribution from the official package manager. Your solutions will be compiled using the following command line: `g++ -Wall -Wextra -...

Full text and comments »

  • Vote: I like it
  • +1505
  • Vote: I do not like it

35.
By zscoder, history, 7 years ago, In English
[Tutorial] Generating Functions in Competitive Programming (Part 1) Hi everyone! Inspired by the recent [Codeforces Round 641](https://codeforces.me/contest/1349), I decided to write an introductory tutorial on generating functions here. I am by no means an expert in generating functions so I will write about what I currently know about them. [user:MiFaFaOvO,2020-05-15] has written a really interesting [blog](https://codeforces.me/blog/entry/76447) here on Codeforces about more advanced applications of generating functions, but I think there is no English tutorial on the basics of this topic yet (or at least on CP sites). Thus, I would like to share about this topic here. I plan to split this tutorial into two parts. The first part (this post) will be an introduction to generating functions for those who have never learned about them at all, and some standard examples and showcases of generating functions. The second part will be a collection of several applications of generating functions in CP-style problems. If you are already familiar with ge...
problem into double or triple summation of binomial coefficients but you need an $O(n)$solution

Full text and comments »

  • Vote: I like it
  • +1299
  • Vote: I do not like it

36.
By MikeMirzayanov, 3 years ago, In English
Polygon: AI-Powered Automatic Tips Hello, Codeforces! <i>For the new members of the community, I would like to remind you that Polygon (https://polygon.codeforces.com/) is a system developed and maintained by Codeforces for preparing programming problems. It is there that authors and coordinators develop all the problems for the rounds. Moreover, I believe a significant (large?) portion of the problems for other competitions is also developed there: various stages of ICPC, national competitions of different levels, educational problems for various courses, etc. <b>In 2023, more than 50000 problems were prepared in Polygon (only those for which a package was compiled are counted)!</b></i> Large language models are becoming an increasingly integral part of our lives, taking over routine and monotonous tasks. With their help, problems created in Polygon will now have fewer typos and incorrect language constructions. We have recently implemented three features in Polygon to ease routine tasks: * Translati...

Full text and comments »

  • Vote: I like it
  • +1190
  • Vote: I do not like it

37.
By MikeMirzayanov, 9 years ago, translation, In English
Codeforces: Results of 2017 <img src="/predownloaded/e4/09/e40915ee54c5991b91098756a90270d94be893b3.jpg"/> Happy New Year, Codeforces! I hasten to wish the whole community (and including me) correct programs, sudden insights, beautiful ideas and interesting problems! I hope that you have met the new year at least as fun as I am. Have you had enough sleep after New Year's Eve? This year, the traditional post summarizing the past year, I sat down to write only on January 1, 2018. I hope that I will not have to sum up the whole year. This post is important to me, since it draws a line to all the work done by the Codeforces team and the entire community in 2017. Many thanks to the team: all of the achievements listed below are the result of joint efforts. We did an excellent job! The community must know its heroes. In 2017, [user:MikeMirzayanov,2018-01-02], [user:KAN,2018-01-02] (problem coordinator), ~gritukan,2018-01-02 (second problem coordinator), ~netman,2018-01-02 (ex-second problem coordinator), ~k...

Full text and comments »

  • Vote: I like it
  • +1319
  • Vote: I do not like it

38.
By parveen1981, history, 6 years ago, In English
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...
Computational Geometry](https://codeforces.me/blog/entry/63814) - [Is the solution of this geometry, ) - [A more elegant solution to 1054H — Epic Convolution](https://codeforces.me/blog/entry/82165, ) - [ICPC Graph Mining Challenge solution ](https://codeforces.me/blog/entry/79734) - [Algorithm Gym, /entry/67664) - [DP Optimisation Problem](https://codeforces.me/blog/entry/52695) - [O(n)solution, solution of this geometry problem actually optimal?](https://codeforces.me/blog/entry/80599, solution to online FFT](https://codeforces.me/blog/entry/59452) - [SQRT decomposition](https

Full text and comments »

  • Vote: I like it
  • +1500
  • Vote: I do not like it

39.
By tourist, 9 years ago, In English
My strategy at AtCoder & CS Academy There's been much controversy lately about the late submission strategy not penalized by scoring systems of AtCoder and CS Academy. Most of the relevant discussion happened earlier at http://codeforces.me/blog/entry/53431 and http://codeforces.me/blog/entry/53449. I have a lot of thoughts on the topic, so I've decided to share them in a separate blog post. I really like the strategic part of programming competitions. Of course, problem solving is more important. But every contest consists of multiple problems, so there has to be a way of comparing participants which performed better at different problems. There's a huge variety of scoring rules, and I find it truly amusing. The "submit after solving all problems" strategy looks widely attributed to me now, mostly due to [user:Petr,2017-07-24]'s remarks regarding my participation in AtCoder contests. In my opinion, it's wrong for multiple reasons. A closer five-word description of my strategy is "implement after solvin...
problem. This helps understand whether one should look for a simple solution. 6. At some, solution. 6. At some moment, I feel stuck in every problem I haven't solved yet (possibly an empty set

Full text and comments »

  • Vote: I like it
  • +972
  • Vote: I do not like it

40.
By Geothermal, history, 7 years ago, In English
Remove Virtual Contestants from Contest Leaderboards As most of you are likely aware, cheating in virtual contests (typically by submitting prewritten or copied solutions in order to appear at the top of the leaderboard) is very common. Most recently, [user:wannabecandidatemaster,2020-05-28] submitted solutions to all problems in [this round](https://codeforces.me/contest/1358/standings) in order to take first place in the standings, and [user:bemandrei,2020-05-28] competed virtually in [this round](https://codeforces.me/contest/1360/standings) after competing in the round officially, and ended up in second place on the leaderboard. In response to the rise of VC cheating (as well as some other issues with the VC system I'll describe below), I'd like to make a simple proposal: **Remove all virtual participants from the contest leaderboards.** The one exception is that you should see your own name on leaderboards for contests you VCed (that is, virtual contestants should be visible only to themselves). Similarly, virtual participan...
achieving the intended goals of the VC feature. One might claim that the solution is simply to, , rather than just the pre-tests, so it is impossible for them to FST: if their solution fails a test, One might claim that the solution is simply to identify cheaters and remove them from the standings

Full text and comments »

  • Vote: I like it
  • +1001
  • Vote: I do not like it

41.
By KAN, 6 years ago, In English
How to set a Div. 1 or a Div. 2 round on Codeforces As you probably know, most of the rounds on Codeforces are created by active community members. We are very grateful to our talented authors from all around the world for bringing their ideas to tens of thousands of competitors, providing fun and learning experience for contestants of every expertise, from beginners to the world's top programmers. This post will cover the steps you need to take propose a round and become a problem writer on Codeforces. ## Who can be a problem author Best problems usually come from the most experienced participants. We have limited resources for rounds reviewing, so to make the process flawless for writers, starting January 1st, 2021, the following requirements for problem authors will be applied: - rating: 2100 or above, or - was a writer in the past. The restrictions may be updated in the future, the post will be updated accordingly. If your round is already in the review status, don't worry, it will be reviewed regardless of the current...
), and of course correct solution. Also, you will need to create tests to check the contestants

Full text and comments »

  • Vote: I like it
  • +932
  • Vote: I do not like it

42.
By dario2994, 6 years ago, In English
About Problemsetting (for AtCoder and Codeforces) Since the amount of information available about the preparation of a competitive programming contest for AtCoder/Codeforces is very little, I decided to collect here what was my experience. I will try to both describe my experiences and give some general advice to wannabe problemsetters. I hope that this will be useful to future problemsetters who are "out of the loop". Moreover, participants might be curious to know what happens behind the scenes (and maybe the platforms may consider this as a form of constructive feedback). *Acronyms*: - AGC = Atcoder Grand Contest - GR = Codeforces Global Round ### Why I know something about problemsetting? I am in the competitive programming world since ~8 years: I have participated in IOI/ICPC/GCJ and a number of contests on AtCoder/Codeforces (and lately Codechef). I am not a top participant but, being in this world for so long, I know, more or less, all the standard tricks. Recently, I was the author of the *flagship conte...
(if necessary), a validator, and a stupid generator. 3. Write the optimal solution and (if, : I sent a problem (with statement, constraints, sketch of the solution) and in a couple of days (or, The editorial should be a pleasure to read, should give insight into the solution, should provide a, solution, writing the generator for the tests, writing the validator for the tests, and, when necessary

Full text and comments »

  • Vote: I like it
  • +936
  • Vote: I do not like it

43.
By tourist, 3 years ago, translation, In English
Code Weekend #1 <div align="right" margin="20px"> <img align="right" src="/predownloaded/72/f1/72f1f31badb1452243838a0fc2553c04accff164.jpeg" alt="logo" width="300px" height="300px" margin="20px"/></div> Hello everyone! We, the [RGBTeam](https://clist.by/team/Romka,tourist,%E2%88%A83886090/) ([user:qwerty787788,2024-05-21], [user:Romka,2024-05-21] and [user:tourist,2024-05-21]), are huge fans of heuristic programming competitions and are quite saddened by the fact that they are becoming less and less frequent each year. One day, we decided to organize our own competition :) Despite the fact that such ideas often remain just ideas, this time we have a serious mindset, and now we want to invite you all to participate in the first — and hopefully not last — **[Code Weekend #1!](https://codeweekend.dev)** The competition will be held in a format quite similar to ICFPC/Google Hashcode — there will be one problem and several dozen tests for it. You will need to submit just an output according to t...
) receives 0.1 TON. - 300 TON will be distributed equally for the best solution of each test at the end

Full text and comments »

  • Vote: I like it
  • +1034
  • Vote: I do not like it

44.
By MikeMirzayanov, 8 years ago, translation, In English
Hello, ITMO! <img src="https://assets.codeforces.com/images/itmo-logo.png" style="margin:1em 1em 1em 1em; float:right;"/> Hi Codeforces! For you, perhaps it was yet another Codeforces round. But not for me. [contest:1066] is the first round tested on new judging servers at ITMO University. And this is not just an update of location. Ta-dam! Now your solutions will be judged on the new Intel i3-8100 processors. And this is not all news. The number of judging servers has increased, which means fewer queues during rounds! I am pleased to announce that now I live in St. Petersburg, I work at ITMO, and Codeforces is gradually moving from the walls of dear to me Saratov University to ITMO University. The decision to move was not easy for me. My plan is that, based on ITMO, I can focus more on Codeforces development and work on the platform. The number of world champions per square meter is simply overwhelming, and working with a large team of such enthusiasts (and professionals!) of sports pro...

Full text and comments »

  • Vote: I like it
  • +1331
  • Vote: I do not like it

45.
By MikeMirzayanov, 5 years ago, In English
C++20 Is Released Hello, Codeforces. Please, welcome c++20 support on Codeforces. Yes, it is 64-bit. Thanks to Brecht Sanders: I used his distribution GCC-11.2.0-64 from https://winlibs.com/. If you have installed [PBOX](http://pbox.me/packages), you can add this compiler with the line `pbox install gcc11-64-winlibs`. Probably, a good idea is to add `C:\Programs\gcc11-64-winlibs\bin` into the PATH. More about PBOX you can read [here](https://codeforces.me/blog/entry/18274). I use the compilation command line similar to other GCC installations: `g++ -Wall -Wextra -Wconversion -static -DONLINE_JUDGE -Wl,--stack=268435456 -O2 -std=c++20 <source>`. The only differences are `-std=c++20` and `-Wall -Wextra -Wconversion` (I plan to use somehow such warnings in Polygon to suggest fixes in uploaded files). Now you can use c++20 in your solutions. I'm not sure there are many features useful in competitive programming. Probably, I'm wrong. For example, now you can write `vector v{vector{1, 2}};` inste...

Full text and comments »

  • Vote: I like it
  • +1524
  • Vote: I do not like it

46.
By MikeMirzayanov, history, 11 years ago, translation, In English
How to come up with the solutions: techniques As I work with students I often face the situation when if a problem doesn't seem clear to a student at the first sight, it makes them unable to solve it. Indeed, you always hear about specific methods and techniques. But you don't hear about how to think in order to apply them. In this note I'll try to sum up my experience of solving programming contest problems. However, some pieces of advice will also be applicable for olympiads in mathematics and your first steps in academic research. So you've read a problem and you don't know how to solve it. Try the following techniques, some of them can often come handy. ##### Technique 1: "Total Recall" Try to remember some similar problems that you had to solve. Quite many problems do not have a brand new idea. So probably, you can use your experience of solving a similar problem to solve this one. ##### Technique 2: "From Specific to General" Let's say that you've found the solution for the problem (hurray!). Let's consider ...
Specific to General" Let's say that you've found the solution for the problem (hurray!). Let's consider, hypothesis on a wide set of tests as it would be a pain to waste time on implementing asolution based on, is prime, then the solution should go like that", and so on. Sometimes your teammates will pick up, the composition of the solution. To see a pattern, you sometimes need to write some naive method of, think in images, imagine the solution, see it unfolding., useful to see the problem limits. Having picked a method, try thinking on the solution assuming that, * the solution always exists; * item the number of states isn't large., Let's say that you've found the solution for the problem (hurray!). Let's consider some particular, Note that the solution of a specific case almost always isn't easier than the solution of a general

Full text and comments »

  • Vote: I like it
  • +731
  • Vote: I do not like it

47.
By neal, 8 years ago, In English
Don't use rand(): a guide to random number generators in C++ Don't use `rand()`. Why? Let's jump right into some code. What value will the following code print, approximately? ~~~~~ #include <cstdlib> #include <iostream> using namespace std; const int ITERATIONS = 1e7; int main() { double sum = 0; for (int i = 0; i < ITERATIONS; i++) sum += rand() % 1000000; cout << "Average value: " << sum / ITERATIONS << '\n'; } ~~~~~ Should be about 500,000, right? Turns out it depends on the compiler, and on Codeforces it prints 16382, which isn't even close. [Try it out yourself](http://codeforces.me/contest/1025/customtest). ### What's happening here? If you look up [C++ documentation on `rand()`](https://en.cppreference.com/w/cpp/numeric/random/rand), you'll see that it returns "a pseudo-random integral value between `0` and `RAND_MAX`." [Click again on `RAND_MAX`](https://en.cppreference.com/w/cpp/numeric/random/RAND_MAX) and you'll see that "This value is implementation dependent. It's guaranteed that th...
### What's the solution? Don't worry, as of C++11 there are **much better** random number, , and how to make your solution unhackable](https://codeforces.me/blog/entry/61675).

Full text and comments »

  • Vote: I like it
  • +891
  • Vote: I do not like it

48.
By maomao90, 3 years ago, In English
Editorial for Hello 2024 ### [problem:1919a] Author: [user:maomao90,2024-01-02] <spoiler summary="Hint 1"> When does the game end? </spoiler> <spoiler summary="Solution"> Depending on whether the player chooses to exchange wallets with their opponent on step $1$, $1$ coins will be removed from either the opponent's wallet or the player's wallet. This means that if either of the players still has remaining coins, the game will not end as at least one of the choices will still be valid. The only way that the game ends is when both players have $0$ coins. Since each operation decreases the total amount of coins by exactly $1$, the only way for Alice to win the game is if $a + b$ is odd. </spoiler> <spoiler summary="Code"> ~~~~~ #include <bits/stdc++.h> using namespace std; int main() { int t; cin >> t; while (t--) { int a, b; cin >> a >> b; if ((a + b) % 2 == 0) { cout << "Bob\n"; } else { cout << "Alice\n"; } } ...
#### Modified statement, > 1$ was chosen in the optimal solution. We can always choose to do the operation on index $1, Code ReLU segment tree. A similar method can be used to solve the, Depending on whether the player chooses to exchange wallets with, Let us consider a dynamic programming solution. Let $dp_{i, v, optimal solution operates on during time $t$ is $x_t$. Let $r$ be the minimum time where $et+1\le r\le, possible that the cost of the modified solution increases by $1$ while the cost of the optimalsolution, same method. However, let us consider what happens if we let our modified solution do an operation on, ~~~~~ #include using namespace std;, Author: [user:maomao90,2024-01-02] Full solution: [user:dario2994,2024-01-02], Following the greedy approach for all 3 cases will result in a correct solution that runs in $O(n, Now that we managed to construct a modified solution which follows the greedy algorithm from time, Suppose there exists an optimal solution that does not follow our algorithm. We will let $OT_{t, i, We want to come up with a modified solution that does the same operations as the optimalsolution

Full text and comments »

Tutorial of Hello 2024
  • Vote: I like it
  • +760
  • Vote: I do not like it

49.
By Wind_Eagle, 5 years ago, translation, In English
Codeforces Round #741. How contest author is entertaining. Hello, Codeforces! Not too long ago there was my second round, Codeforces #741 (Div. 2). Before it started, I wondered: surely there will be a lot of cheating on my round, just like on any other? So I decided to do something unusual. As you know from [a blog about cheaters] (https://codeforces.me/blog/entry/93893), it's easy to find telegram/youtube channels with cheaters. So I decided to find a couple and join them... So, the first telegram group I found was [link not available yet]. There weren't too many cheaters in it but they were, here's an example: <spoiler summary="Picture"> <a href="https://imgbb.com/"><img src="https://i.ibb.co/kJqMzMS/pic1.png" alt="pic1" border="0"></a> </spoiler> I joined this telegram group, and there was a meaningful dialogue: <spoiler summary="Picture"> <a href="https://ibb.co/1mC2csG"><img src="https://i.ibb.co/VqFB6HY/pic2.png" alt="pic2" border="0"></a> </spoiler> This may seem unbelievable, but the admin of the group actuall...
A little later, they even wrote half the solution for problem 1562A:, However, there are cheaters who are also scammers! Apparently, he got the solution of another

Full text and comments »

  • Vote: I like it
  • +950
  • Vote: I do not like it

50.
By kostka, 5 years ago, In English
Cheater Report in Global Round 15 In the last contest, both [user:tourist,2021-07-26] and [user:ko_osaga,2021-07-26] copied the author's solution from the problem Matrix from Petrozavodsk Winter Camp 2013 Warsaw U contest: [submission:123723552] and [submission:123727448] respectively. You can easily verify that they didn't write this code themselves by looking at the comments in these solutions (written in Polish). This is **against the Codeforces rules**. According to [this post](https://codeforces.me/blog/entry/8790), we have the following rules: > Solutions and test generators can only use source code completely written by you, with the following two exceptions: > > 1. the code was written and published/distributed before the start of the round, > 2. the code is generated using tools that were written and published/distributed before the start of the round. and > Currently, the only reliable proof is the presence of code on the Internet and the presence of the used edition in the cache of well-kn...
author's solution from the problem Matrix from Petrozavodsk Winter Camp 2013 Warsaw U contest, need to add a comment mentioning the original source of the problem and this solution doesn't have

Full text and comments »

  • Vote: I like it
  • +910
  • Vote: I do not like it

51.
By Qingyu, 17 months ago, In English
About the Universal Cup, the Semifinals, and myself... Hey'all! This gonna be a long post, so let me put an important TLDR here first: we are going to host **The 3rd Universal Cup Semifinals**, which will take place on August 24, 2025 **online**, at [11:00 (UTC)](https://www.timeanddate.com/worldclock/fixedtime.html?msg=The+3rd+Universal+Cup+Semifinals&iso=20250824T19&p1=33&ah=5). This contest will be a part of our Finals Team Selection, which the detailed rules and announcements will be published later next week. --- Now for some extra context, if you're interested. Last week, we hosted the [last online stage](https://codeforces.me/blog/entry/143954) of The 3rd Universal Cup. After that, I posted a [feedback form](https://docs.google.com/forms/d/1g5Txhiirh_lRsvGfkYWRozu0WDDGK31IAXjB7VgeVoM/edit) on our discord server. I received lots of thoughtful responses (P.S — it's still open, so feel free to fill it out if you haven't yet!). I've read through all the feedback, and I'd like to share a few thoughts. ### On the Number...
solution yet, and I'd really appreciate your opinions.

Full text and comments »

  • Vote: I like it
  • +814
  • Vote: I do not like it

52.
By ATSTNG, history, 7 years ago, In English
[Tutorial] Matroid intersection in simple words **[This article is also available in [Russian](https://codeforces.me/blog/entry/69287?locale=ru)]** Hello, CodeForces. I think that matroids are beautiful and powerful concept, however, not really well known in competitive programming. I’ve discovered matroids at 2019 Petrozavodsk Winter Training Camp. There was a problem that clearly cannot be solved using usual techniques I knew, editorial for this problem was just these three words “just matroid intersection”. Back then it took me more than 2 days of upsolving to find all the information and details I need and implement solution that gets Accepted on this. And it took way longer to actually understand why does it work and exactly how does it work. (I still hesitate in some details.) Of course, it is not hard to google up all the definitions and some related articles, but in my opinion they all are focused more on mathematical part of theory, strict proofs in some not really obvious but short ways, and observing only ke...

Full text and comments »

  • Vote: I like it
  • +904
  • Vote: I do not like it

53.
By unreal.eugene, 5 years ago, In English
Polygon Updates (June — August 2021) Hello, Codeforces. I and [user:DK318,2021-08-19] joined the Codeforces team in June. These three months we mainly dealt with the development of the Polygon platform. In this post, we would like to present to you a list of what we have done during this time. Most of the changes were made to attain easier problem creation. This list does not include minor bug fixes or any improvements that are invisible to users. #### Tables support when rendering statements in HTML Now it's possible to insert the most basic tables in your HTML statements. For example, you can show the scoring system of your problem or insert several images side by side. Only column text alignment and border specification are supported now. <img src="/predownloaded/4a/4a/4a4a6c726e96df40929803a1276a448947d6ebed.png" style="width: 800px; margin-left: auto; margin-right: auto; display: block"/> #### A brief manual for writing statements We bet a lot of users who wrote statements were confused by the fact ...
the invocation report containing a summary of every solution in every test group. It can be helpful, the solution tags. Now you can select multiple tags and even select a rectangle of tags with a, #### Multiple edit option of solution tags

Full text and comments »

  • Vote: I like it
  • +1013
  • Vote: I do not like it

54.
By shiven, history, 2 years ago, In English
A summary of what passes for an Indian ICPC Contest, apparently The online round for the India’s ICPC was held on 23rd. And also a week before that. The first time around, the organisers tried debuting a self-hosted DOMjudge instance. That didn’t go too well, so a recontest was scheduled on CodeChef. If you’re not too familiar with the Indian ICPC system — this online prelims is used to select teams that can participate in the offline regionals. From a single university, usually approx. 2 teams (for the top unis) or 1 (for almost all unis that aren’t in top-15) qualify. As you could guess, it’s quite easy for good teams to miss a spot. Looking at the first contest’s rankings, teams from rank 2 to 100+ all had 4 solves. Owing to severe system issues in the first contest, the time penalties weren’t too reliable differentiators, leading to the recontest this Saturday. In hindsight, we forgot to be grateful for the problemset and reliable testcases the first time. I’m sure everyone agrees that the basic requirements (ignoring all other stuff...
admin, finalised as the official solution., mess up the testcases. [The official solution gets hacked... again.](https://codeforces.me/blog/entry, obviously wrong solutions. (Notice the **obviously:** as we’ll soon see, the officialsolution, problem? Can setters now admit that a contest needs a provably correct solution ? (On a side-note, our team, some incorrect model solution. The admin then ACed with a recursive brute-force, with the above non, . (Notice the **obviously:** as we’ll soon see, the official solution shared by the contest admin, /problems/CS2023_PON). Also, as will be a recurring theme here, the official solution [is easily hacked, Somehow, the end result → neither does the model brute-force solution work in time, nor do the test, To add to that, the solution is presented in a way that pretends that the complexity is *obviously

Full text and comments »

  • Vote: I like it
  • +925
  • Vote: I do not like it

55.
By dario2994, 6 years ago, In English
Editorial of Global Round 11 #### General comments Broadly speaking, problems A-B-C-D were "div2 problems", while F-G-H were "strong grandmaster problems" (with E staying in the middle). I did not expect anyone to solve all the problems and thus I decided to give the scoring F+G=H (so that maybe someone would have solved H). <br><br> Many of the problems (A, C, D, E, G) admit multiple solutions. Sometimes the core of the solution is the same (C, D) and sometimes the solutions are truly different (A, E, G). <br><br> If you are an experienced participant, I would like to hear your opinion on the problems. Feel free to comment on this post or send me a private message. <br><br> <spoiler summary="Overview of the problemset" > The easiest problem of the contest, *A-Avoiding Zero*, is about rearranging an array of numbers. It is intended as a very easy problem that still requires to think. Then, in *B-Chess Cheater* an intuitive (but nontrivial to prove) greedy approach is the way to go. *C-The Hard Work of P...
=vF_-ob9vseM&feature=emb_logo), knowing the solution to the latter is not very helpful. It is a very, Many of the problems (A, C, D, E, G) admit multiple solutions. Sometimes the core of thesolution, solution is the same (C, D) and sometimes the solutions are truly different (A, E, G).

Full text and comments »

  • Vote: I like it
  • +758
  • Vote: I do not like it

56.
By okwedook, 6 years ago, In English
Codeforces Round #703 (Div. 2) Hi, Codeforces! I finally get to return something to this great community, so I am glad to invite you to take part in [Codeforces Round #703 (Div. 2)](https://codeforces.me/contest/1486), which will take place on [contest_time:1486]. The round will be **rated for the participants with rating lower than 2100**. Participants from the first division are also welcomed to take part out of competition. You will be given **2 hours 15 minutes** to solve **6 problems**. All the problems were created and prepared by me. One of the problems is interactive, please read [the guide of interactive problems](https://codeforces.me/blog/entry/45307) before the contest. I would also like to thank: <ul> <li> [user:antontrygubO_o,2021-02-16] for excellent coordination! </li> <li> [user:1-gon,2021-02-16], [user:3EVEHAR_KOAVA,2021-02-16], [user:Akulyat,2021-02-16], [user:Aleks5d,2021-02-16], [user:BRCode,2021-02-16], [user:Osama_Alkhodairy,2021-02-16], [user:PO3OBAR_Bblnb,2021-02-16], [user:...
* [user:Aleks5d,2021-02-17] for proposing another solution to one of the problems.

Full text and comments »

  • Vote: I like it
  • +908
  • Vote: I do not like it

57.
By cjj490168650, history, 4 years ago, In English
[Repost] "Justice may be delayed, but it cannot be absent": New Evidence on NXIST's Cheating Scandal _Original post: [「正义可以迟来但不能缺席」:关于 NXIST 的一些新证据](https://zhuanlan.zhihu.com/p/620297880)_ _Translated by GPT-4 with some adjustment. Please inform me if there are any mistakes._ _All links to the invalid repository have been redirected to the backup repository._ **This article provides a logically complete set of evidence, which does not involve any non-public internet resources, regarding the "suspected cheating" incident involving the ICPC Yinchuan Station and ICPC Shenyang Station in 2021. By discovering the suspected GitHub account ([NaokiLH](https://github.com/NaokiLH), renamed to https://github.com/brokenTarget) of a team member from Ningxia Institute of Science and Technology (NXIST) TS 1 team, Lan Hao, two years ago, and by mining and analyzing the commit records of his algorithm competition repo, we have obtained direct evidence that at least 4 questions from the 2021 Yinchuan regional contest set and at least 6 questions (including scrapped questions) from the 2021 Sh...

Full text and comments »

  • Vote: I like it
  • +1018
  • Vote: I do not like it

58.
By PinkieRabbit_buster, 3 years ago, In English
PinkieRabbit Cheated in Div. 1 Contest on Apr 27 I am writing to report an incident of cheating by PinkieRabbit during the recent contest 1965 on Codeforces. **PinkieRabbit asked help about problem D from others during the contest,** which is definitely against the contest rules. I have attached the evidence of the cheating behavior in the appendix, please read it. This evidence clearly shows the communications PinkieRabbit had with another person during the contest. It is a contest recording video published after contest by himself. As a former fan of PinkieRabbit, after seeing this video, I was shocked by how dishonest PinkieRabbit was. I believe such actions undermine the integrity of the competition and the platform as a whole. [user:win114514,2024-05-05] cheated by grouping up in contest 1905, finally punished by skipping. Therefore, I respectfully request that Codeforces take appropriate action against PinkieRabbit to maintain the fairness of the contests on Codeforces. He only cheated in one problem this round, so I sugg...
F: But my solution must be definitely correct., While PinkieRabbit's conversation is clearly asking for a solution to problem D in the game, the

Full text and comments »

59.
By tourist, history, 7 years ago, In English
Codeforces Global Round 5 Editorial Enjoy! <spoiler summary="A. Balanced Rating Changes"> [tutorial:1237A] <spoiler summary="Solution by tourist"> ~~~~~ #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; int flag = 1; for (int i = 0; i < n; i++) { int x; cin >> x; if (x % 2 == 0) { cout << x / 2 << '\n'; } else { cout << (x + flag) / 2 << '\n'; flag *= -1; } } return 0; } ~~~~~ </spoiler> </spoiler> <spoiler summary="B. Balanced Tunnel"> [tutorial:1237B] <spoiler summary="Solution by tourist"> ~~~~~ #include <bits/stdc++.h> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> a(n), b(n); for (int i = 0; i < n; i++) { cin >> a[i]; --a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; --b[i]; } vector<int> pos(n); for (int i = 0; i < n; i++) { pos[b[i...
~~~~~ #include

Full text and comments »

  • Vote: I like it
  • +569
  • Vote: I do not like it

60.
By Radewoosh, 8 years ago, In English
Blogewoosh #3 Hello, codeforces! This time I've decided to choose a task from my own contest which took place last April and was known as the Grand Prix of Poland. If you want to write this contest virtually in the future, then consider not reading this blog. If you've participated in this contest and maybe even solved this task, then anyway I recommend reading it, cause this task has many very different solutions, each of them being very interesting (in my opinion). It's also a reason why this blog is longer than previous ones. I'll write about task C "cutting tree" (not uploaded to the ejudge yet :/). The statement goes as follows: You are given a tree with $n$ vertices ($1 \leq n \leq 2 \cdot 10^5$). The task is to calculate $f(k)$ for each integer $k$ from the range $[1, n]$ where $f(k)$ is defined as the maximum number of connected components of size $k$ which we can "cut off" from the tree. A connected component of size $k$ is a set of $k$ vertices such that it's possible to traverse ...
$\log$ factor, which is very surprising even for me, so please, if something's wrong with thissolution, correct? Take an optimal solution. If this vertex is not in this solution, we can add it with its, It turns out that this solution works in this same complexity but is substantially faster.

Full text and comments »

  • Vote: I like it
  • +767
  • Vote: I do not like it

61.
By Sanae, history, 7 months ago, In English
Apology for faults in Codeforces Round 1098 Hello, I'm Sanae. In ufc+8 zone, I watched the entire contest at midnight. Too many cheaters emerged and we were busy banning them. I noticed WA submissions on [problem:2228B], [problem:2228C2] and TLE submissions on [problem:2228D], which was intended. Soon after the end of the contest, I released the editorial. The bad news was, the complaints flooded the website and my contribution fell from +91 to -92. After reflecting on the issues, I was anixous and blamed myself. Now, I make an apology to point out the problems to avoid them next time. Sorry, everyone! 1. Too many cheaters emerged. [Comment 1](https://codeforces.me/blog/entry/153617?#comment-1365371) 2. The problems stay in the queue for a very long time bothered contestants. 3. B is easy but many contestants misssed the corner case. And C has many corner cases. [Comment 1](https://codeforces.me/blog/entry/153617?#comment-1365212), [Comment 2](https://codeforces.me/blog/entry/153617?#comment-1365256), [Comment 3...
seconds can be enough for the best solution, some correct solutions are killed, which obey the principle

Full text and comments »

  • Vote: I like it
  • +813
  • Vote: I do not like it

62.
By adamant, history, 19 months ago, In English
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 FFT solution to [Wildcard Pattern Matching](https://judge.yosupo.jp/problem

Full text and comments »

  • Vote: I like it
  • +731
  • Vote: I do not like it

63.
By Um_nik, history, 2 years ago, In English
Hacking (as a CF feature) does not fit modern competitive programming 1. How does hacking work with the new feature of unrated registration? I have seen this question raised in the comments to the announcement several times, but there is no answer still and I think it's weird that Mike hasn't thought about it before announcing. 2. I was working recently on a div.2 Codeforces round (still might happen in the future) and I was told by my coordinator that pretests should be equal to systests in all the problems. From this I can conclude that it is a Codeforces policy and intentionally weak pretests do not happen. It doesn't mean that it is impossible to hack anybody, but it doesn't sound like a viable strategy. I find it weird that this information is not public, it's like I'm getting bonus information about all other Codeforces rounds by setting a round myself. I have done exactly zero research on the matter, but my feeling is that 99% of hacks (I'm talking about during-the-round-hacking here, not open hacking of education rounds and such) happen in ...
cases when authors didn't break some popular for some reason wrong solution, and every room has (15+-3

Full text and comments »

  • Vote: I like it
  • +1015
  • Vote: I do not like it

64.
By SecondThread, history, 6 years ago, In English
Petition to revoke unrated account permissions to post comments/blogs Unrated Account Disaster ================== Recently there have been an obscene number of unrated accounts showing up. Several of them have inappropriate names, so I won't give examples because I want to keep this post clean, but I'm sure you have seen them in the comments. They are likely all by the same individual, possibly with a few copy-cat troublemakers as well. Recently, certain ones have begun to spam useless comments on old posts to clog up the recent actions, effectively hiding all relevant conversations except on the blog posts they spam on. For whatever reason, these are overwhelmingly on [user:Errichto,2020-07-10]'s old blog posts. Occasionally there are also a flood of obscene blog posts made by the user themselves. Here's an example of what I mean: ![ ](https://wumbogames.github.io/cfPictures/Spam.png) #### This is obnoxious and I would like to see it stop. The current solution clearly doesn't work. As soon as they get banned or muted or whatever, they c...
Suggested Solution ------------------, The current solution clearly doesn't work. As soon as they get banned or muted or whatever, they

Full text and comments »

  • Vote: I like it
  • +761
  • Vote: I do not like it

65.
By MikeMirzayanov, 7 years ago, translation, In English
Codeforces: Results of 2019 <a style="float:right; display: inline-block; margin:0 1em 1em 2em; max-width: 60%;" href="https://codeforces.me/10years"/> <img style="max-width:100%" src="https://assets.codeforces.com/images/codeforces-10-years-300.png"/> </a> Hi Codeforces! The platform recently turned 10 years old. We accept your congratulations at <a href="https://codeforces.me/10years">https://codeforces.me/10years</a>. Please review the progress in 2019 and support the anniversary crowdfunding campaign. Your donation will be a contribution to the future of Codeforces, will help its development and work. We need resources to continue to host rounds, not to stop developing, to innovate and to maintain the existing infrastructure. In 2019, together with numerous writers the coordinators worked on problems: [user:KAN,2020-02-06], [user:300iq,2020-02-06], [user:cdkrot,2020-02-06], [user:arsijo,2020-02-06] and recently joined [user:isaf27,2020-02-06]. And this year, rounds coordinated by other exper...

Full text and comments »

  • Vote: I like it
  • +1154
  • Vote: I do not like it

66.
By maroonrk, history, 6 years ago, In English
TL Issue in the #659 (Div. 1) Problem F I've hacked all AC solutions of [this](https://codeforces.me/contest/1383/problem/F) problem, which were submitted during the contest, and I believe I can hack most of upsolving solutions. Currently, I only checked that they time out on my local machine, because "Unexpected Verdict" prevents me from uphacking. I even hacked model implementation in the editorial. [Here](https://ideone.com/cHvjkp)'s my latest generator. Feel free to challenge it. Side Note: [user:yosupo,2020-07-26] wrote a [solution](https://codeforces.me/contest/1383/submission/88036534), which passes the above case, but I failed it with another [generator](https://ideone.com/LKx3FP). What I want to argue is that TL of this problem is too tight, and it affected some of the competitors. For example, I got almost the same idea as the model solution during the contest. Still, I was too scared to write it because I suspected it would time out without full optimization and possibly some tweaks like shuffling ve...
a [solution](https://codeforces.me/contest/1383/submission/88036534), which passes the above case, I'm not saying the round should be unrated; I think there exists a really well-optimizedsolution, P.S. Please notify me when you believe your solution can pass all tests, I'll try to challenge it., Side Note: [user:yosupo,2020-07-26] wrote a [solution ](https://codeforces.me/contest/1383

Full text and comments »

  • Vote: I like it
  • +1015
  • Vote: I do not like it

67.
By vovuh, history, 6 years ago, In English
My thoughts on clarifications and on the round #677. Alright, I'm done. I wanted to write a blog like that for a long time, but now I really don't have enough patience to ignore this issue anymore. I want to say that I get 100-200 clarifications each Div.3 round. It doesn't even matter how well the statements are, it doesn't matter if there are any issues with solutions or checkers, people always find what to ask. Before I start whining here, I really want to recommend anyone to read these two [user:Um_nik,2020-10-20] blogs: [this one](https://codeforces.me/blog/entry/62730) and [this one](https://codeforces.me/blog/entry/62744). Sorry, [user:Um_nik,2020-10-20], I unnecessarily tagged you, I will not do that anymore. Now some breaking news for most participants: _your local IDE compiler_ and _Codeforces compiler_ are **actually** different things! If your code works fine locally but gets WA/TL/RE/ML/etc on Codeforces, it (most probably) means you have a bug somewhere in your code. There are rare cases when the issue is with comp...
already partially prepared. I read the statement, wrote the solution and it matched my understanding of

Full text and comments »

  • Vote: I like it
  • +979
  • Vote: I do not like it

68.
By -is-this-fft-, history, 5 years ago, In English
[Tutorial] Collection of little techniques #### Introduction There are a number of "small" algorithms and facts that come up again and again in problems. I feel like there I have had to explain them many times, partly because there are no blogs about them. On the other hand, writing a blog about them is also weird because there is not that much to be said. To settle these things "once and for all", I decided to write my own list about about common "small tricks" that don't really warrant a full tutorial because they can be adequately explained in a paragraph or two and there often isn't really anything to add except for padding. This blog is partly inspired by [user:adamant,2022-03-15]'s [blog](48417) from a few years ago. At first, I wanted to mimic adamant's blog structure exactly, but I found myself wanting to write longer paragraphs and using just bolded sentences as section headers got messy. Still, each section is short enough that it would not make much sense to write separate blogs about each of these things. A...
and a segment tree solution might not always be possible., A classical bitset solution is to let $\mathrm{dp}[v]$ be a bitset such that $\mathrm{dp}[v][u] = 1, The completely naive solution then would be to iterate over all $a$, starting from 0, and stopping, The solution is to simply iterate over numbers slightly below and above $n$ and check if they are

Full text and comments »

  • Vote: I like it
  • +804
  • Vote: I do not like it

69.
By Errichto, 6 years ago, In English
Matrix Exponentiation tutorial + training contest tl;dr &mdash; video tutorial https://www.youtube.com/watch?v=eMXNWcbw75E and codeforces GYM training https://codeforces.me/gym/102644 (register by finding this contest in GYM instead of using the link directly) video editorial: [part 1 (ABCDEF)](https://www.youtube.com/watch?v=kQuCOFzWoa0) and [part 2 (GHI)](https://www.youtube.com/watch?v=RA_SpxP2t54) codes to all 9 problems: https://github.com/Errichto/youtube/tree/master/matrix-exponentiation Prerequisites: binary exponentiation and iterative dp (you don't need to know matrices) The youtube tutorial ([link](https://www.youtube.com/watch?v=eMXNWcbw75E)) focuses on intuition and graph-like visualization . Or, if you prefer, below is a shorter (less detailed) text tutorial instead. You can practice by solving a set of 9 educational problems in GYM https://codeforces.me/gym/102644. ABCD are easy, EF medium, GHI are hard. If you are stuck, see hints below or watch the full solution analysis &mdash; [part 1 (ABCDEF)](https:...

Full text and comments »

  • Vote: I like it
  • +606
  • Vote: I do not like it

70.
By jiry_2, history, 9 years ago, In English
A simple introduction to "Segment tree beats" Hi, I’d like to introduce a simple trick about segment tree in this blog as I promised in [this comment](http://codeforces.me/blog/entry/54750?#comment-387957). Sorry for the long delay, as a sophomore in Peking University, I've just finished a tired semester and a painful final exam. And now I finally have enough time to do a simple introduction to this interesting algorithm. It may be a huge project for me since my English is not good. I think I will finish this blog in several steps and I will try to finish it as soon as possible :) In China, all of the 15 candidates for the Chinese National Team are asked to write a simple research report about algorithms in informatics Olympiad, and the score will be counted in the final selection. There are many interesting ideas and algorithms in these reports. And I find that some of them are quite new for competitors in CF although they are well known in China from the final standings of some recent contests. For example, In the last co...

Full text and comments »

  • Vote: I like it
  • +771
  • Vote: I do not like it

71.
By ace5, 3 years ago, translation, In English
It's unfair Today I got this message: <spoiler summary="Spoiler"> ![ ](/predownloaded/0a/0b/0a0bd878d9a61bd3ad9c646d5adddf6612a0ad51.png) </spoiler> When looking at the solutions of the listed participants on the problem [1951B](https://codeforces.me/contest/1951/problem/B) I saw that all these solutions completely (or with a change of variables) same as mine, so it's not just a coincidence, solutions copied from mine. Since I didn't give my solution to anyone, and didn't keep the code publicly available, this could only happen if one of the participants blocked this task, copied my code, and sent it to the others. Indeed, it turns out that in my room only one participant blocked task B &mdash; [user:_Untrackable_,2024-04-12](the nickname speaks for itself). He blocked this task at 1:44, and if you look at the submissions of participants from the list, you can see that many of them earlier sent code for this task that was completely different from mine (some even in other languages!), ...
, solutions copied from mine. Since I didn't give my solution to anyone, and didn't keep the code publicly, solution to anyone, and didn't keep the code publicly available, this could only happen if one of the

Full text and comments »

  • Vote: I like it
  • +1054
  • Vote: I do not like it

72.
By tourist, history, 10 years ago, translation, In English
VK Cup 2017 Round 3 + Codeforces Round #412 -- Tutorial Here is the tutorial of VK Cup 2017 Round 3 and Codeforces Round #412. Enjoy! <spoiler summary="Is it rated?"> [tutorial:807A] <spoiler summary="Code"> ~~~~~ n = int(input()) results = [] for i in range(n): results.append(list(map(int, input().split()))) for r in results: if r[0] != r[1]: print("rated") exit() for i in range(n): for j in range(i): if results[i][0] > results[j][0]: print("unrated") exit() print("maybe") ~~~~~ </spoiler> </spoiler> <spoiler summary="T-Shirt Hunt"> [tutorial:807B] <spoiler summary="More efficient code"> ~~~~~ #include <bits/stdc++.h> using namespace std; int main() { int p, x, y; cin >> p >> x >> y; for (int s = y; ; s++) { if (s % 50 != x % 50) { continue; } bool me = false; int i = s / 50 % 475; for (int j = 0; j < 25; j++) { i = (i * 96 + 42) % 475; if (i + 26 == p) { me = true; ...
~~~~~ #include

Full text and comments »

  • Vote: I like it
  • +570
  • Vote: I do not like it

73.
By MikeMirzayanov, history, 11 years ago, translation, In English
New: Educational Rounds on Codeforces! Hi everybody! First, I invite you to take part in an official [contest:597]. The fact is, the Codeforces team has made numerous changes to the platform (details are below), and we want to be sure that the basic functionality remained unchanged. This round will have a shortened duration of 1.5 hours, consist of 3 (maybe 4) problems that you might have already seen before. Its purpose is to test the system on the one hand, and on the other hand &mdash; to brighten up a Wednesday evening. Of course, the round will be unrated. Now the main thing. This coming Friday (yes, the 13th of November) Codeforces starts another line of rounds. We called them Educational Rounds. Using my students at the Saratov State University Programmings Competitions Training Center as an example, I regularly notice that even those who have a considerable progress in the results on the rounds often have narrow purview in terms of standard topics and ideas, they are not familiar with many well-known problems ...
-hour period of open hacks — any visitor of Codeforces may try to hack any completesolution to a

Full text and comments »

  • Vote: I like it
  • +1052
  • Vote: I do not like it

74.
By SecondThread, history, 6 years ago, In English
Algorithms Thread 9: Treaps (+ Gym Contest!) Algorithms Thread Episode 9: Treaps ================== Good morning everyone! [Episode 9 of AlgorithmsThread](https://youtu.be/6x0UlIBLRsc) comes out shortly after the Div2 round ends. This episode is on Treaps! It covers: - Fundamentals of Treaps - Splitting and Merging - Range reversing ... and more! I also decided to keep up the super-high quality style and made a [custom gym set](https://codeforces.me/gym/102787) with 5(+2) original problems to make sure you really understand everything that was covered in the lecture. The gym set will be released shortly after the lecture ends, and I hope that the problems will be challenging and fun, even for people who aren't seeing treaps for the first time. If you have any questions or suggestions, feel free to leave them below. I hope you enjoy the problem statements, and, in the spirit of the upcoming holiday, I'll leave you all with this: ![ ](http://wumbogames.github.io/cfPictures/GrimTreaper.png) <hr /> Update:...
Update2: [Solution video is out now](https://youtu.be/eNPWQuFzyHA) and [solutions to all problems

Full text and comments »

  • Vote: I like it
  • +969
  • Vote: I do not like it

75.
By Errichto, 8 years ago, In English
Sums and Expected Value — part 1 part 2: https://codeforces.me/blog/entry/62792 Watch my lecture-stream tomorrow (Thursday) at [14:00 CEST](https://www.timeanddate.com/worldclock/fixedtime.html?msg=EV+lecture+1&iso=20181025T14&p1=262) &mdash; <s>[https://www.youtube.com/watch?v=qdlPY37MBPo](https://www.youtube.com/watch?v=qdlPY37MBPo)</s> [https://www.youtube.com/watch?v=U_h3IjreRek](https://www.youtube.com/watch?v=U_h3IjreRek). I will go through theory and problems from this blog. The only prerequisite is knowing what is probability. The next (harder) part on Monday. The video will be available later, with timestamps for each problem &mdash; so you don't have to watch everything. ### Definition of EV Let's say we bought a lottery ticket for 2$. We will win 10$ with probability 10%, and 20$ with p-bility 2%. On average, it gives us $0.1 \cdot 10 + 0.02 \cdot 20 = 1.4$, so we are worse off after buying the ticket. The computed average is called the expected value. The expected value (EV, expecta...

Full text and comments »

  • Vote: I like it
  • +614
  • Vote: I do not like it

76.
By MikeMirzayanov, 10 years ago, translation, In English
About the Round 382 Good afternoon! I've decided to share my thoughts on the round 382. Of course, it turned upset not only to me, but also to the round coordinator [user:GlebsHP,2016-11-28]. In this round the main negative feedback were caused by two problems: [problem:735D] and [problem:735C]. Regarding [problem:735D]. I do not share the criticism to this problem. In fact, to solve it would be nice to be familiar with <a href="https://en.wikipedia.org/wiki/Goldbach&apos;s_conjecture"> Goldbach's Conjecture</a> and better with <a href="https://en.wikipedia.org/wiki/Prime_number_theorem">Prime Number Theorem</a>. These facts are medium-popular in the world of programming contests. Familiarity with them is useful, gives useful insight into primes. It is important: in this problem it was necessary to perform a simple, but nevertheless, additional step to find solution. It seems to me that it's okay to use problems that have a reduction to some popular and semi-popular topics. Otherwise, it is th...
necessary to perform a simple, but nevertheless, additional step to find solution. It seems to me

Full text and comments »

  • Vote: I like it
  • +1288
  • Vote: I do not like it

77.
By YouKn0wWho, 4 years ago, In English
[Tutorial] Common Mistakes in Competitive Programming and How to Avoid Them One thing is for sure. You do make mistakes. I also make miskates and that's what makes us human. But what we can surely do is &mdash; to try to minimize the errors that we make throughout our life. I have compiled some of the mistakes that I made in my early Competitive Programming phase. I also mentioned how to avoid them. Also, in most cases, I will give you a chance to find out what the bug is before I reveal the culprit as I tried to make this blog interactive. The codes that I have used in this blog have been written in C++ as it is the most used language for CP. **So, if you are new to CP, stick with me as you might don't wanna repeat the mistakes that I made when I was a beginner.** #### Mistake 1 Check out the following code: <spoiler summary="Code"> ~~~~~ #include<bits/stdc++.h> using namespace std; int main() { int a = 1000'000'000,b = 1000'000'000; long long product = a * b; cout << product << '\n'; return 0; } ~~~~~ </spoiler> The outp...

Full text and comments »

  • Vote: I like it
  • +634
  • Vote: I do not like it

78.
By Radewoosh, history, 8 years ago, In English
Blogewoosh #7 Hello, codeforces! Long time no see, right? So maybe it's a good idea to try to return to my blogs slowly. This time the blog will be about a trick, which usually isn't necessary to solve a task, but can be useful to make implementation much more comfortable. Let's look at [this](https://codeforces.me/contest/932/problem/F) problem. It is about some DP on a tree in which we have to use convex hull trick to improve the complexity. The task requires merging two convex hulls with "smaller to bigger" trick. I recommend you to read the statement before reading the rest of the blog (and the [editorial](https://codeforces.me/blog/entry/57796) if you don't know how to solve it). [cut] $ $ So, how to merge two convex hulls? If we keep them in something like the set from C++, then we can just take every element from the smaller one and try to add it to the bigger one. Unfortunately, adding one element in this way requires some ifology and care. It's hard to implement it, especiall...
solution as fast as the model solution.

Full text and comments »

  • Vote: I like it
  • +697
  • Vote: I do not like it

79.
By zscoder, history, 10 years ago, In English
[Tutorial] Non-trivial DP Tricks and Techniques Hi everyone! Today I want to share some DP tricks and techniques that I have seen from some problems. I think this will be helpful for those who just started doing DP. Sometimes the tutorials are very brief and assumes the reader already understand the technique so it will be hard for people who are new to the technique to understand it. Note : You should know how to do basic DP before reading the post DP + Bitmasks ------------------ This is actually a very well-known technique and most people should already know this. This trick is usually used when one of the variables have very small constraints that can allow exponential solutions. The classic example is applying it to solve the Travelling Salesman Problem in $O(n^{2} \cdot 2^{n})$ time. We let $dp[i][j]$ be the minimum time needed to visit the vertices in the set denoted by $i$ and ending at vertex $j$. Note that $i$ will iterate through all possible subsets of the vertices and thus the number of states is $O(2^{n} \cdo...
First, we look at the naive solution :, My solution only works up to Subtask $4$. The official solution uses a different method but the, This solution originated from the comment from [user:WJMZBMR,2016-10-15] [here](http

Full text and comments »

  • Vote: I like it
  • +612
  • Vote: I do not like it

80.
By KAN, 21 month(s) ago, In English
Codeforces Blitz Cup 2025 Hi Codeforces! As announced earlier, we’re holding an individual competition, the Codeforces Blitz Cup 2025, to celebrate 15 years of Codeforces. The tournament features PvP matches in a novel Blitz format, where every second (literally!) counts. In a 40-minute match, the opponents rush to solve each consecutive problem quicker than the rival. One needs to come up with a correct solution, think over the optimal implementation, and code cleanly: only the first one to get a problem correctly claims the points. <spoiler summary="Complete Blitz rules"> - Each match lasts 40 minutes, with 7 problems of increasing difficulty (worth 2, 3, 4, 6, 8, 10, and 12 points). - Problems are revealed one at a time, in the order of increasing difficulty. - Only the first contestant to solve a problem earns points. - Once a problem is solved, it becomes unavailable, and the next one is revealed after 60 seconds. Contestants need to code the solution from scratch. It is forbidden to use ...
Contestants need to code the solution from scratch. It is forbidden to use prewritten code (except

Full text and comments »

  • Vote: I like it
  • +644
  • Vote: I do not like it

81.
By -is-this-fft-, history, 6 years ago, In English
How to ask for help in PM There was a blog today with a similar title, and although it was (I think, not really sure as I didn't get a good look) some kind of satire/joke blog, I wanted to post some serious advice about things I (don't) like to see when people are PMing me. However I decided that this wouldn't be in the spirit of the blog and decided to make a separate blog. And now that blog is deleted anyway. While it's not a bad thing to write messages to more experienced users, most people who write me do things that make them very difficult to deal with. These are my opinions, but somewhy I feel that many reds will agree. Some things here feel silly to write because they are so obvious. But I'm only writing them because people regularly mess them up. [cut] $~$ ####Use punctuation and spelling. There are some [very simple rules](https://codeforces.me/blog/entry/82186#comment-689836) that make your messages infinitely more readable. I find it especially strange when many of these messagers call...
> Have you tried the following: > > - Write a very naive and simple solution to the problem

Full text and comments »

  • Vote: I like it
  • +746
  • Vote: I do not like it

82.
By SlavicG, 5 years ago, In English
How to use Codeforces [GUIDE] I see a lot of newcomers struggling to use the website to it's fullest, so I decided to write a blog that has all important information about how to use Codeforces in a single place. I will update it with time, so feel free to write your suggestions/questions in case I missed something and I will be glad to add it to the post! I would like to thank [user:_Vanilla_,2022-02-05] and [user:mesanu,2022-02-05] for helping me write the blog, and [user:Monogon,2022-02-05], [user:down,2022-02-05] and [user:AlperenT,2022-02-05] for proofreading and giving suggestions. #### Navigating through pages ![ ](https://media.discordapp.net/attachments/705371983650619454/928235498487570442/bandicam_2022-01-05_12-36-00-134.jpg?width=991&height=110) It's possible to navigate through most pages of Codeforces using the bar on the top, I will talk about what each tab does more in depth below: #### The Help Page The help page contains the answer to a lot of questions about Codeforces, such as rati...
present it doesn't mean that the solution must be related to that tag, but there is asolution using, #### Verdicts Accepted — it means the solution passed all the given tests and is correct., #### What is time limit? The time limit is the most amount of time your solution will run on a, Hacked — it means your solution passed all tests but was hacked by another user during the, Memory limit exceeded — it means your solution takes more amount of memory than the limit, Pretests passed — it means the solution passed a subset of tests during the contest and it, Time limit exceeded — it means your solution takes longer to execute than the time limit of

Full text and comments »

  • Vote: I like it
  • +726
  • Vote: I do not like it

83.
By Phantasmagorias, history, 5 years ago, In English
Codeforces Round #745 Editorial I'm very sorry about all the inconvenience, and I would like to bear the blame. Much thanks to those who help me prepare this round. It's not their fault. And much thanks to your participation. [problem:1581A] ------------------ idea: [user:interlude,2021-09-30] preparation: [user:CQXYM,2021-09-30] tutorial: [user:CQXYM,2021-09-30] Assume a permutation $p$, and $\sum_{i=2}^{2n}[p_{i-1}<p_i]=k$. Assume a permutaion $q$, satisfying $\forall 1 \leqslant i \leqslant 2n, q_i=2n-p_i$. We can know that $\forall 2 \leqslant i \leqslant 2n,[p_{i-1}<p_i]+[q_{i-1}<q_i]=1$. Thus,$\sum_{i=2}^{2n}[q_{i-1}<q_i]=2n-1-k$, and either $p$ should be counted or $q$ should be counted. All in all, the half of all the permutaions would be counted in the answer. Thus, the answer is $\frac{1}{2}(2n)!$. The time complexity is $O(\sum n)$. If you precalulate the factors, then the complexity will be $O(t+n)$. ----- <spoiler summary="solution"> ~~~~~ #include<stdio.h> int f[100001]; int m...

Full text and comments »

  • Vote: I like it
  • +799
  • Vote: I do not like it

84.
By Um_nik, history, 14 months ago, In English
On AI ruining "solving math problems with computer" [a year later] I guess you were right in the part "a year from now LLMs will solve problems on your level". You were also saying something along the lines of "you'll change your mind when it starts affecting you". In this part, you were wrong. Cheaters always existed, and they always will. LLMs make it easier to cheat, true. There is no way of completely preventing LLM cheating (or any other kind of cheating) in online competitions. I just coordinated the round everyone is buzzing about, so I can with confidence say that in the CF rules for coordinators and authors, there isn't anything about making problems LLM-proof. Not for easy problems, not for hard problems, nothing. And I doubt any such rules will appear. LLMs are forbidden by the rules, that's that. So we, as honest participants (yes, I will assume that you are an honest participant, otherwise this blog is not applicable to you and I don't care about you), will have to accept that some problems in the future rounds will be LLM-able, ...
got AC just have seen this problem before and copied their old solution.

Full text and comments »

  • Vote: I like it
  • +680
  • Vote: I do not like it

85.
By brunomont, 6 months ago, In English
Chinese Postman Problem: How I Ran a 180 km Ultramarathon Through Every Street in My City Hello, Codeforces! A couple of years ago, a friend of mine told me that two cyclists had passed through every single street in the center region of the city I live in (Belo Horizonte, southeastern Brazil), on the [third try](https://www.strava.com/activities/1030665876/overview). <spoiler summary="First try"> After ~160 km, they had not completed 1/3 of the goal. [Strava link](https://www.strava.com/activities/976021527). <img src="/predownloaded/8a/53/8a53829f7d78e88808a3ff751b64406ec2fc0efd.png" style="width: 600.0px;max-width: 100.0%;max-height: 100.0%;"> </spoiler> <spoiler summary="Second try"> They were better prepared, but one of the guys was run over by a car (no big injuries). [Strava link](https://www.strava.com/activities/999450285). <img src="/predownloaded/85/8f/858fdcdcfda93cd1d9c7c59db7dbfad9e63d6ea2.png" style="width: 600.0px;max-width: 100.0%;max-height: 100.0%;"> </spoiler> <center> <img src="/predownloaded/8d/5c/8d5cfb677a361654105e49f36f214c35...
is, we know the solution is optimum, because the sum of the weights of the edges is a lower bound for, The first observation is that a solution exists if, and only if, the graph is connected (assuming

Full text and comments »

  • Vote: I like it
  • +802
  • Vote: I do not like it

86.
By rama_pang, history, 6 years ago, In English
[Tutorial] Li Chao Tree Extended Hello everyone! I discovered a new (?) trick on how to apply lazy propagation on the Li Chao Tree and decided to write a blog about it. I've personally never seen it before (outside of myself), nor have I seen a problem that needs the Extended Li Chao Tree specifically, but it *can* overkill some problems. Of course, I might not be looking hard enough... You can learn about the basics of Li Chao Tree from [cp-algorithms](https://cp-algorithms.com/geometry/convex_hull_trick.html) or [this simple blog](https://robert1003.github.io/2020/02/06/li-chao-segment-tree.html). The Extended Li Chao Tree can do the following problems (and other variations): ## Problem 1 There is an array $A$ of size $N$. There are $Q$ online operations: - Range Line Insertion. Given $l$, $r$, $a$, $b$, do $A_i = \max(A_i, a \cdot i + b)$, $\forall i \in [l, r]$ in $O(\log^2 N)$ - Range Line Addition. Given $l$, $r$, $a$, $b$, do $A_i += a \cdot i + b$, $\forall i \in [l, r]$ in $O(\log^2 N)$. - Po...
**Solution.** See the solution described at:, **Solution.** The solution is the same as the previous one. Also, [variation 3](https

Full text and comments »

  • Vote: I like it
  • +608
  • Vote: I do not like it

87.
By tourist, history, 9 years ago, translation, In English
Hello 2018 -- Tutorial Here is the tutorial of Hello 2018. Enjoy! <spoiler summary="Modular Exponentiation"> Problem writer: [user:tourist,2018-01-08] [tutorial:913A] <spoiler summary="Solution"> ~~~~~ #include <bits/stdc++.h> using namespace std; int main() { int n, m; scanf("%d %d", &n, &m); printf("%d\n", n >= 31 ? m : m % (1 << n)); return 0; } ~~~~~ </spoiler> </spoiler> <spoiler summary="Christmas Spruce"> Problem writer: [user:BudAlNik,2018-01-08] [tutorial:913B] <spoiler summary="C++ solution"> ~~~~~ #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<int> p(n), deg(n); for (int i = 1; i < n; i++) { cin >> p[i]; p[i]--; deg[p[i]]++; } vector<int> sons_leaves(n); for (int i = 0; i < n; i++) { if (deg[i] == 0) { sons_leaves[p[i]]++; } } for (int i = 0; i < n; i++) { if (deg[i] > 0 && sons_leaves[i] < 3) { puts("No"); return 0; } } puts...
~~~~~

Full text and comments »

Tutorial of Hello 2018
  • Vote: I like it
  • +463
  • Vote: I do not like it

88.
By TheOneYouWant, history, 7 years ago, In English
Editorial — Codeforces Round #646 Hello, everyone! It was a delight for us to have you participate in our contest. We hope you enjoyed the problems! Here, we present to you the solutions of the problems. I have also prepared some memes for you to enjoy &mdash; disclaimer: not all of them were created by me. [tutorial:1363A] Author of this problem was [user:Ashishgup,2020-05-31]. <spoiler summary="Relevant Meme"> ![ ](/predownloaded/cd/f1/cdf13618b93c6243dec10ec495181286a2616caa.jpg) </spoiler> <spoiler summary="Code for A"> ~~~~~ #include <bits/stdc++.h> using namespace std; #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define endl "\n" #define int long long const int N = 2e5 + 5; int n, x; int a[N], f[2]; int32_t main() { IOS; int t; cin >> t; while(t--) { f[0] = f[1] = 0; cin >> n >> x; for(int i = 1; i <= n; i++) { cin >> a[i]; f[a[i] % 2]++; } bool flag = 0; for(int i = 1; i <= f[1] && i <= x; i ...

Full text and comments »

  • Vote: I like it
  • +854
  • Vote: I do not like it

89.
By Kuroni, history, 7 years ago, In English
Codeforces Round #616 Hello Codeforces o(≧∇≦o) I'm glad to introduce you to [contest:1290] and [contest:1291], which will take place on [contest_time:1290]. Each division will contain **6 problems**, and you will have **2.5 hours** to solve them. There might be interactive problems, feel free to learn about them [here](https://codeforces.me/blog/entry/45307). The problems were created by [user:265918,2020-01-30], [user:Ari,2020-01-30], [user:Kuroni,2020-01-30], [user:gamegame,2020-01-30], and [user:hugopm,2020-01-30]. Now, here are some people I would love to mention: - Thank you [user:isaf27,2020-01-30] for being a super helpful, diligent, and humorous coordinator ヽ(〃・ω・)ノ - Thanks to [user:McDic,2020-01-30], [user:nvmdava,2020-01-30], [user:dorijanlendvaj,2020-01-30], [user:antontrygubO_o,2020-01-30], [user:sdssudhu,2020-01-30], and [user:farmersrice,2020-01-30] for helping with the preparation of the tasks. - Thanks to [user:Sofie_Ever,2020-01-30], [user:mcfr,2020-01-30], [user:MathisHamm...

Full text and comments »

  • Vote: I like it
  • +739
  • Vote: I do not like it

90.
By twosquares, 11 months ago, In English
Good Bye 2025 Editorial We'd like to thank you all for participating in the contest, and hope you enjoyed it. Any feedback would be appreciated! <!-- You lost the game. --> <spoiler summary="Rate the contest"> - Great contest: - Good contest: - Average contest: - Bad contest: </spoiler> --- <spoiler summary="Did Franklin (from problem D) succeed in massacring a village of innocent elves like Frieren and Dilhan (from problem E)?"> The official lore is that he got lost in a forest of oddly colored Christmas trees (from problem F) and decided instead to write this editorial. </spoiler> <!-- ########### --> <!-- #PROBLEM A# --> <!-- ########### --> <h2>[problem:2178A]</h2> <spoiler summary="Did you like the problem?"> - Great problem: - Good problem: - Average problem: - Bad problem: - Did not solve: ...

Full text and comments »

Tutorial of Good Bye 2025
Tags sus
  • Vote: I like it
  • +697
  • Vote: I do not like it

91.
By geranazavr555, 7 years ago, translation, In English
Polygon updates (June-October 2019) Hello, Codeforces! I and [user: cannor147,2019-11-07], as students of ITMO University, joined the Codeforces team in June. From June to October, we mainly dealt with the development of the Polygon platform. In this post, we would like to present to you a list of what we have done during this time. This list does not include minor bug fixes or any improvements that are invisible to users. #### PIN codes for problems and contests Sometimes very important contests and problems are being developed in Polygon. In such cases, a leader of the jury may be worried about data leaking. For example, it can be so because of the weak password of another member of the jury. PIN code is an additional factor of confirmation the access for the problem or contest and it can be set up only by the owner. It is assumed that the PIN code will be sent in another secure way. There is a link Create Pin for the owners in the contest interface: ![Create Pin in the interface](https://i.ibb.co/bgcg8C...
#### Solution notes, You can attach additional information on the solution by clicking on Note in the solutions list.

Full text and comments »

  • Vote: I like it
  • +739
  • Vote: I do not like it

92.
By -is-this-fft-, history, 7 years ago, In English
[Tutorial] The DFS tree and its applications: how I found out I really didn't understand bridges #### Introduction This is a tutorial/exploration of problems that can be solved using the "DFS tree" of a graph. For a way too long time, I didn't really understand how and why the classical algorithm for finding bridges works. It felt like many tutorials didn't really explain how it works, kind of just mentioned it in passing and quickly just moved on to implementation. The day someone explained what the DFS tree is, I finally understood it properly. Before, it took me ages to implement bridge-finding properly, and I always had to look up some detail. Now I can implement it at typing speed. But more importantly, I began to see how the same techniques can be used to solve graph problems that have more or less nothing to do with bridges. The thing is, when you have a black box, you can only ever use it as a black box. But if you have a box that you understand well, you can take it into pieces, repurpose the pieces for completely different things, all without getting lost...
I know of a solution without using the ideas of DFS tree in linear time, but it is quite annoying

Full text and comments »

  • Vote: I like it
  • +565
  • Vote: I do not like it

93.
By Radewoosh, history, 8 years ago, In English
Blogewoosh #5 (with images from now) Hello, codeforces! Because after Round #507 sad men in suits visited me in my flat, this time I won't write about any task from the future. Instead, this blog will be about my own trick. I said "my own," but probably some of you have already heard about it or even figured it out, but I've developed it by myself, so I consider it as my own. In particular, it's **GEOMETRY TIME!!!**. But please, don't escape already. I also don't like this topic so much, that's why I really like this trick. Let me tell you a story from one onsite Polish contest, which took place a few months ago. I was thinking about one of the problems, and I've figured out that I had to do some binary-search (on doubles) and then check if a set of half-planes has a non-empty intersection. The answer would tell me in which direction should I turn in the binary search. Firstly, I grabbed my head, because I've never written an intersection of half-planes. I had my acm library with [user:Errichto,2018-09-07]'s code...

Full text and comments »

  • Vote: I like it
  • +801
  • Vote: I do not like it

94.
By antontrygubO_o, history, 7 years ago, In English
On problemsetting 2 [Previous part](https://codeforces.me/blog/entry/70178) Hi there again! Previous part with opinions of some amazing problemsetters turned out to be interesting for you, so I decided to gather some more opinions :D. I really hope that this post will help someone in their problemsetting future! #### When and how did you start problemsetting? [user:300iq,2020-01-11]: April, 2017 [user:maroonrk,2020-01-11]: In 2015 Summer, I hold the first contest with friends at high school club. It was a local Japanese contest. [user:Radewoosh,2020-01-11]: In high school, so probably for 5 years. I was creating problems for other people from my school as my teacher told me that it's a completely different point of view. [user:voidmax,2020-01-11]: It was 3 years ago. I was on plane and I didn't have a clue what to do in my free time. Then I realized that I can try myself in problemsetting. Later I created first and one of my favorite problem ([problem:963B]). I was full of inspiration a...
with the solution., solution should be about. ([problem:1097H])

Full text and comments »

  • Vote: I like it
  • +631
  • Vote: I do not like it

95.
By Dominater069, 2 years ago, In English
Analyzing how good O1-Mini actually is I would like to thank [user:redpanda,2024-09-13] and [user:qmk,2024-09-13] for their great help in writing and reviewing this blog. They are also the users who queried O1-mini for all the following problems. We tried O1-mini on several problems, from a variety of sources. Let's list the results first. **Note** : - Some of the WA verdicts here actually means that the AI just "stopped thinking" which means the AI thought for a long enough time without any useable results so it ran into an error. - All ratings mentioned are Codeforces ratings, the Atcoder ratings have been converted to codeforces rating. To measure the approximate codeforces rating of the atcoder problems mentioned here, you can use https://kenkoooo.com/atcoder/#/table/ + https://silverfoxxxy.github.io/rating-converter. <h4> D2ABs </h4> - [problem:1762B] [<a class="rated-user user-gray" title="Gray">1100</a>] <a class="rated-user user-green" title="Green AC">AC</a> - [problem:1998B] [<a class="rated-...
"solve"? Often, even when the AI can't really reason the solution, if the solution is simple enough

Full text and comments »

  • Vote: I like it
  • +583
  • Vote: I do not like it

96.
By yosupo, history, 7 years ago, In English
New online judge: Library-Checker! Hello, codeforces! Today, I introduce yet another online judge, [Library-Checker](https://judge.yosupo.jp/)! As the name suggests, the object of this site is checking your libraries. The problems are "[Implement RMQ](https://judge.yosupo.jp/problem/staticrmq)", "[Enumerate Primes](https://judge.yosupo.jp/problem/enumerate_primes)", "[Exp of Formal Power Series](https://judge.yosupo.jp/problem/exp_of_formal_power_series)", "[Decompose a graph into three-connected components](https://judge.yosupo.jp/problem/three_edge_connected_components)"... and so on. All problems are managed by me. In other words, I'm the admin of this site. Anything of problems (testcases, solutions, generator, ...) are managed in [github](https://github.com/yosupo06/library-checker-problems). It means, - Anyone can add problems add testcases. Already most of the problems are prepared by other competitive programmers. - Testcases are stronger and stronger with time (ideally). Let's enjoy your l...

Full text and comments »

  • Vote: I like it
  • +902
  • Vote: I do not like it

97.
By djm03178, history, 6 years ago, In English
Codeforces Round #688 (Div. 2) **오랜만이에요, 코드포스!** (Long time no see, Codeforces!) I'd like to welcome all of you to [contest:1453]! The contest will start at [contest_time:1453], and it is **rated** for all participants with ratings under 2100. **Note the semi-unusual start time**. You will be given **6 problems** and **2 hours and 15 minutes** to solve them. The score distribution will be announced soon. All problems are prepared by me, with a lot of help from the testers <s>making me realize that my solutions are dumb</s>. Thanks to [user:Green55,2020-11-30], [user:JooDdae,2020-11-30], [user:cs71107,2020-11-30], [user:CodePlatina,2020-11-30], [user:FlowerOfSorrow,2020-11-30], [user:jh05013,2020-11-30], [user:Anus1373,2020-11-30], [user:39dll,2020-11-30], [user:alswhp,2020-11-30], [user:Ku_Top,2020-11-30], [user:sonjaewon,2020-11-30], [user:slah007,2020-11-30], [user:jooncco,2020-11-30], and [user:__rkm__,2020-11-30] for testing the round, and especially [user:xiaowuc1,2020-11-30] for helping polish Engl...

Full text and comments »

  • Vote: I like it
  • +757
  • Vote: I do not like it