Please watch! https://youtu.be/4B3g4NLdbuA
I've solved and explained all five problems of Codeforces Round 948 (Div. 2), the video will appear in about an hour.
UPD: the video is available.
№ | Пользователь | Рейтинг |
---|---|---|
1 | tourist | 3757 |
2 | jiangly | 3647 |
3 | Benq | 3581 |
4 | orzdevinwang | 3570 |
5 | Geothermal | 3569 |
5 | cnnfls_csy | 3569 |
7 | Radewoosh | 3509 |
8 | ecnerwala | 3486 |
9 | jqdai0815 | 3474 |
10 | gyh20 | 3447 |
Страны | Города | Организации | Всё → |
№ | Пользователь | Вклад |
---|---|---|
1 | maomao90 | 171 |
2 | adamant | 164 |
3 | awoo | 163 |
4 | TheScrasse | 159 |
5 | nor | 155 |
6 | maroonrk | 154 |
7 | -is-this-fft- | 152 |
8 | Petr | 147 |
9 | orz | 145 |
9 | pajenegod | 145 |
Please watch! https://youtu.be/4B3g4NLdbuA
I've solved and explained all five problems of Codeforces Round 948 (Div. 2), the video will appear in about an hour.
UPD: the video is available.
I have recorded a screencast & editorial for Codeforces Round 947 (Div. 1 + Div. 2). It will upload on https://youtu.be/DrBmSO86xUQ in an hour or two.
UPD: the video is uploaded.
Tomorrow (in 12 hours) is the main day of my first ICPC WF! The preparation is over. We are not worried, but, unfortunately, after all the rounds of Ptz, UCup, previous years' ICPCps, it is clear to us that we will not win a medal without any luck. Please cheer for us and wish us luck! For two of our team, including me, this is our last attempt at the finals.
You should be able to find us tomorrow somewhere on https://www.youtube.com/@ICPCLive/, we will be 47th WF St. Petersburg State University team.
Good evening everyone!
TL;DR: I am in Luxor preparing for ICPC WF and making some photos, and also I was offered to (and I will) give an interview to Shayan, please send your questions.
I really liked today's Codeforces Global Round 25! I got a pretty nice positive delta, although, unfortunately, I failed to settle down all the nasty conditional probabilistic formulae in 1951G - Clacking Balls and solved one problem less than I could have.
I uploaded my screencast and editorial on YouTube: https://www.youtube.com/watch?v=4-8kp8B2Dig. Surprisingly, the video is still processing, so it is still impossible to watch it. But it should become available in several minutes.
UPD: the video is available.
UPDUPD: the video is available in high resolution.
Today I participated in a pretty nice CodeTON Round 8 (Div. 1 + Div. 2, Rated, Prizes!) and recorded a pretty nice Screencast and Editorial of problems A–G. You are welcome to watch it!
UPD: now the video is in high quality.
In contests and in the custom invocation, after a pause, one can again find GNU G++20 64-bit. However, the slowdown issue because of which the language disappeared persists, there are still snippets of code that can slow down the execution on Codeforces servers by a factor of 100 or so.
So what is the official position of Codeforces headquarters and of our community on that?
Are there general methods of constructing testcases that can exploit this GCC/Windows bug and therefore slow down solutions (like there are anti-hash tests for solutions using unordered_set
)? Are there methods that slow down both contest mode and custom invocation mode (since 249807302 is only slow in the contest mode whereas 253289473 is only slow in the custom invocation)?
If so, should we expect such tests in future contests, will such methods be used during the test preparation in contests?
If this is deemed an unwanted bug, will participants be protected from unscrupulous hacks and tests? (For example, if the solution was hacked or FSTed because of a compiler bug rather than because of anything else, will the author be able to appeal against it and get their solution accepted?)
Is there no bug in 32-bit version? If it's 64-bit only, maybe CF team could add a C++20 32-bit compiler? UPD: 32-bit version can also be slowed down, see 253400416.
Is there this bug in Microsoft Visual C++ compilers (32 or 64 bits)? If so, is it the reason why we cannot see it among the options?
Are there generic methods of protecting against the bug (except switching to 32 bits)? I read (and enjoyed) a blogpost by ToxicPie9 regarding this issue, he suggested to add several lines of code to the solution. However, it does not always help: 253290209 still gets TL (and the author said about that).
Has anyone a clue what is going on, why do the aforementioned programs run slowly? Is this bug reported to the GNU or Microsoft developers who are responsible for this strange behavior?
Why does behavior in custom invocation and in contest/gym mode differ?
Is this bug reproducible on other platforms? For instance, on godbolt there are some windows compilers. Is there a way to slow down this code: https://godbolt.org/z/5G73dfezK (by cleverly choosing the value of evil
or anything else)? UPD: probably no way since Godbolt uses UCRT rather than MSVCRT. UPDUPD: this code is slow on Godbolt: https://godbolt.org/z/WE4Mxv9cK, so UCRT is also flawed.
Is there surely no such bug on Linux? (Anyway, with regard to Codeforces it is probably a pointless question. I am quite certain that transition of all invokers to Linux is the last thing MikeMirzayanov would prefer to do since it is for sure really costly in time, effort, architecture changes, and/or money.)
14 January 2024 I tested Codeforces Round 922 (Div. 2). It was under secrecy until the round was published. Now you can see me testing this round! https://youtu.be/yPaIT0h8tcE
Radewoosh вдохновил меня, решив весь Project Euler, и я недавно начал сам медленно, но верно решать оттуда задачи. Буду рад каждому, кто добавит меня в друзья в Project Euler, мой токен дружбы 2127163_HmDkRoxUDZa38znoBSPq2n4Prg996WEX
, можете ввести его на этой странице, если вы зарегистрированы и хотели бы видеть меня в своём списке друзей. (Аналогично, и вы появитесь в моём списке друзей.)
Также я записываю весь процесс (на английском) и загружаю на Youtube, так как, согласно правилам, задачи 1–100 разрешено публично разбирать и обсуждать (впрочем, боюсь, в первой сотне не окажется сколько-нибудь серьёзных или интересных задач). На данный момент опубликованы видеоролики:
Это скринкасты, я бы даже назвал их разборами, но (по крайней мере среди совсем начальных задач) объяснять там почти что нечего. В любом случае, если хотите, то смотрите!
Ну и, конечно, призываю и вас регистрироваться и решать задачи, если вы ещё не приступили!
UPD. Неприятно это говорить, но на Project Euler есть лимит в 64 друзей. Таким образом, я не могу добавить в друзья всех желающих.
Поэтому мне придётся сделать какой-то приоритет и удалять тех, у кого он самый низкий. Некоторые варианты вроде времени добавления в список друзей — очень низкокачественные приоритеты, так что рассматривать их не будем. Вместо этого я решил удалять тех, кто решил меньше всего задач. На данный момент требуется 11 решённых задач. Так что, если я вас удалил, а вы почему-то хотите назад, просто решите пару задач и возвращайтесь!
Похоже, я придумал вам самую странную — а, может, даже кринжовую — мотивацию решать Project Euler. Ну и ладно. Если оно сработает, оно сработает.
Here you can watch how I solved A–F from Hello 2024: https://youtu.be/3TV2VpVbUjM. Unfortunately, I only solved 1919E - Counting Prefixes after the contest has ended because my C++ template was too poor. This is an important lesson for me to collect all important algorithms and finally sit down and include them in the template.
UPD: the video is high resolution now.
Usually Euclid's algorithm, which computes $$$\gcd(a, b)$$$, is implemented as follows:
while b != 0:
a %= b
swap(a, b)
return a
Or, in recursive fashion,
if b == 0:
return a
else:
return gcd(b % a, b)
While it works in $$$\mathcal O(n)$$$ time (where $$$n$$$ is the maximum of binary lengths of $$$a$$$ and $$$b$$$ — that is, big-Theta of the length of the input), it uses quite an expensive operation of integer division. The fastest known procedure of integer division works in $$$\mathcal O(n \log n)$$$ time, so, if we take into account the time spent on arithmetic operations, the time complexity is $$$\mathcal O{\left(n^2 \log n\right)}$$$. But even if we don't, int64
division is still much slower than such operations as addition, subtraction and binary shifts.
If you didn't know there is an algorithm which doesn't need division at all!
def remove_trailing_zeros(a):
return a >> count_trailing_zeros(a)
def gcd_of_odd_numbers(a, b):
if a == b:
return a
if a < b:
swap(a, b)
return gcd_of_odd_numbers(b, remove_trailing_zeros(a - b))
def gcd(a, b)
if a == 0:
return b
if b == 0:
return a
return gcd_of_odd_numbers(remove_trailing_zeros(a), remove_trailing_zeros(b)) << min(count_trailing_zeros(a), count_trailing_zeros(b))
The function count_trailing_zeros(a)
finds the maximum $$$k$$$ such that $$$a$$$ is divisible by $$$2^k$$$. The function remove_trailing_zeros(a)
divides $$$a$$$ by the maximum power of two that divides $$$a$$$. Both these functions can be easily implemented in $$$\mathcal O(n)$$$ time, if we take into account the complexity of arithmetic operations. gcd_of_odd_numbers(a, b)
finds gcd
of the two numbers $$$a$$$ and $$$b$$$, given they are both odd. Everything except the recursive call works in $$$\mathcal O(n)$$$ time. Note that the sum of binary lengths of numbers is decremented by at least one from call to call, so there will be only $$$\mathcal O(n)$$$ recursive calls. Therefore, gcd_of_odd_numbers(a, b)
works in $$$\mathcal O{\left(n^2\right)}$$$ time. Finally, gcd(a, b)
is also obvious to take $$$\mathcal O{\left(n^2\right)}$$$ time.
My question is: why does everyone use the implementation with divisions? Are there some hidden advantages? I didn't compare how much these two take with fixed-length integer types and arbitrary-precision integer types in practice. Did someone in community investigated this question? Did you know about division-less gcd implementation at all? Please let me know in the comments.
Please watch: https://youtu.be/TutRcb1-K3s
UPD: the video is high resolution.
Here it is, already uploaded, already in high quality. Problems 1917D - Yet Another Inversions Problem and 1917F - Construct Tree were hard, so no editorial, only me struggling to solve them.
Сегодня я поучаствовал Pinely Round 3 (Div. 1 + Div. 2) и решил задачи A–G. Я записал видео участия и выложил сюда: https://www.youtube.com/watch?v=CZ6D-5bhgOQ. Там же вы найдёте разбор этих задач сначала на английском, потом на русском. Вы можете воспользоваться таймкодами, чтобы найти ту задачу, которую вам интересно было бы посмотреть.
Наконец, позвольте поделиться радостью: я неплохо выступил, победил tourist, Petr, Benq и Ormlis и вернул титул международного гроссмейстера!
The ICPC Northern Eurasia Finals (a.k.a. Northern Eurasia Regional Contest) took place on 13 December 2023. The onsite participants competed on four venues: St. Petersburg, Russia; Novosibirsk, Russia; Astana, Kazakhstan; and Kutaisi, Georgia.
Congratulations to the medalists of the contest:
Rank | Team | = | Time |
🏆 1 | MIPT: Yolki-palki (Pechalka, Tikhon228, Kapt) | 12 | 1266 |
🥇 2 | HSE: Youthful Passion Fruit (alexxela12345, daubi, talant) | 10 | 982 |
🥇 3 | SPb ITMO: pengzoo (iakovlev.zakhar, golikovnik, DishonoredRighteous) | 9 | 713 |
🥇 4 | MIPT: Log-rank conjecture (sadovan, receed, Jatana) | 9 | 759 |
🥈 5 | SPb SU: block of cats (LeoPro, fastmath, turmax) | 9 | 843 |
🥈 6 | SPb SU: \_ -> chill (UnstoppableChillMachine, D.Pavlenko, Volkov_Ivan) | 9 | 904 |
🥈 7 | MIPT: In God We Trust (antonis.white, gop2024, PeregudovSergey) | 9 | 935 |
🥈 8 | MIPT: Shawarmasters (stepanov.aa, RP-1, PBBx0) | 9 | 1072 |
🥉 9 | HSE: Muffix Sassif (sevlll777, crazyilian, tem_shett) | 9 | 1076 |
🥉 10 | HSE: Drunk Driving in Moscow (Siberian, blyat, Nybik) | 9 | 1223 |
🥉 11 | HSE: am nyam) (vaaven, Ormlis, vsinitsynav) | 9 | 1368 |
🥉 12 | MIPT: Wake right (ZorikVar, ShadowLight, serg3000) | 8 | 905 |
As a result, several teams qualified for the ICPC Finals, which will be held in 2024 in Astana, Kazakhstan:
Rank | Team | = | Time |
🏆 1 | MIPT: Yolki-palki (Pechalka, Tikhon228, Kapt) | 12 | 1266 |
🥇 2 | HSE: Youthful Passion Fruit (alexxela12345, daubi, talant) | 10 | 982 |
🥇 3 | SPb ITMO: pengzoo (iakovlev.zakhar, golikovnik, DishonoredRighteous) | 9 | 713 |
🥈 5 | SPb SU: block of cats (LeoPro, fastmath, turmax) | 9 | 843 |
13 | Belarusian SU: 1: Last hope (MathBoy, ne4eHbKa, VEGAnn) | 8 | 944 |
14 | AITU: jaujurek 3 bala (dolbaeb, dimachine, nkamzabek) | 8 | 1089 |
15 | Yerevan SU: SD3 (mcdx9524, Andreasyan, erankyun) | 8 | 1446 |
16 | MAI: 1 (Inyutin, Belousov, Plyushkin) | 7 | 551 |
18 | Belarusian SUIR: 1: So Stuffy (kartel, p3rfect, romarkovets) | 7 | 673 |
19 | Novosibirsk SU: 1: Avdim last hope (amokrousov, Lylova, Timonnable) | 7 | 770 |
21 | Skoltech: Caravella (madn, kek1234, Goldman) | 7 | 819 |
22 | Tbilisi SU: Darwin Nunez (Macharashvili, Pipia, Khvedelidze) | 7 | 834 |
It is possible that the ICPC committee will increase the quota and allow more NERC teams to attend the Finals.
For the contestants who did not participate onsite, there was an online mirror on Codeforces: 2023-2024 ICPC, NERC, Northern Eurasia Onsite (Unrated, Online Mirror, ICPC Rules, Teams Preferred). I would like to especially highlight the teams who scored total during the contest:
Rank | Team | = | Time |
1 | xinyoudui: PubabaOnO, orzdevinwang, jqdai0815 | 12 | 842 |
2 | HoMaMaOvO: maroonrk, hos.lyric, maspy | 12 | 1266 |
3 | P+P+P: 244mhq, 353cerega, 998kover | 12 | 1339 |
The problemset was prepared by the jury headed by elizarov: cdkrot, VArtem, Aksenov239, goldvitaly, tourist, kgeorgiy, isaf27, izban, _LeMur_, orz, niyaznigmatul, PavelKunyavskiy, pashka and Elena Kryuchkova:
You can find the PDF statements here, and the tutorials here.
Finally, you are welcome to share your thoughts on the problemset in the comments. Also please tell me if there are mistakes in this post. Thanks to all of you who participated and attempted our problems!
I recorded my participation in CodeTON Round 7 (Div. 1 + Div. 2, Rated, Prizes!), after which I explained the solutions of problems 1896A - Jagged Swaps, 1896B - AB Flipping, 1896C - Matching Arrays, 1896D - Ones and Twos and 1896F - Bracket Xoring. The link to the video is https://youtu.be/xNYdRfbuBQ8, but the video is still processing and will be ready for watching in several minutes.
I guess some of you, who will watch this video, have solved problem C. Could you please share your observations which led to the solution? I believe that the fact presented in the editorial is really unobvious, although I didn't have the worst intuition possible in this problem's plot. Instead I came up with a solution which took a (code)ton of time and featured an intricate way of applying std::set
with upper_bound
and discrete continuity. Not bad for making the editorial educational, but really inappropriate for succeeding in the actual contest.
UPD: the video is uploaded, but is temporarily in low resolution.
UPDUPD: the video is now high quality.
4 ноября 2023 года в Университете ИТМО прошёл Тридцать первый командный чемпионат школьников Санкт-Петербурга по программированию. Он является отборочной региональной олимпиадой для Двадцать четвертой открытой всероссийской командной олимпиады школьников по программированию, которая пройдёт 11–12 декабря 2023 года в очном формате. Задачи подготовило жюри во главе с andrewzta: ba.tasya, Niko, Thinkbuge, Volkov_Ivan, golikovnik, orz, DishonoredRighteous, Volodya333, polipolinom, GShark, VArtem, peltorator, doreshnikov, Toy_mouse, step_by_step и fedor.tsarev.
По задачам этого набора прошли также несколько других отборов на XXIV открытую ВКОШП. Вот их список со ссылками на результаты:
В настоящее время контест уже выложен в тренировки: XXXI командный чемпионат школьников Санкт-Петербурга по программированию (СПбКОШП 2023) | Отборочный интернет-тур XXIV открытой всероссийской командной олимпиады школьников по программированию (ВКОШП 2023).
UPD: в контест добавлены призраки, чтобы при прорешивании вы могли видеть в таблице результатов, как успехи у тех команд, которые официально участвовали в этом соревновании.
I participated in Codeforces Round 907 (Div. 2). I believe it could be the first time I was late for a Codeforces Round but still participated in it; however, I solved all problems. The round featured a lot of ideas, which were pretty standard, but it still was kinda nice to discover them here.
Здесь можно посмотреть, как я участвовал в Квалификационном раунде Yandex Cup 2023 Алгоритма, комментируя процесс на английском языке.
I participated in Codeforces Round 898 (Div. 4) and, surprisingly, solved all problems.
You can watch the solutions (please, not during the contest!):
Today a horrible thing almost happened: I barely stayed an International Grandmaster on Codeforces after participation in CodeTON Round 6 (Div. 1 + Div. 2, Rated, Prizes!). I would't say I was exceptionally slow or that I solved problems too clumsily, but for some reason the majority of participants near my level were faster than me on these problems.
I recorded a five hour long video about my adventures. If you're interested in a particular problem, follow the timecodes:
Problem | Solving | Implementation | Editorial |
---|---|---|---|
1870A - MEXanized Array | 01:37 | 02:45 | 3:23:28 |
1870B - Friendly Arrays | 06:23 | 10:54 | 3:30:20 |
1870C - Colorful Table | 12:48 | 14:12 | 3:41:00 |
1870D - Prefix Purchase | 22:14 | 24:41 | 3:58:20 |
1870E - Another MEX Problem | 39:37 | 58:42 | 4:34:24 |
1870F - Lazy Numbers | 1:31:03 | 2:54:32 | 2:30:37 |
If you open a video and see it's low quality, you might want to wait several minutes until YouTube processes the higher resolutions.
UPD. This is high quality now. Please watch!
Dear friends,
Today I tried an experimental format: separate videos. So, today I participated in Codeforces Round 896 (Div. 1) and recorded a screencast, but, unlike the previous times, I did not immediately record the editorials. Instead several videos are dedicated to them. So here are the links:
UPD: I recorded the upsolving of 1869F - Flower-like Pseudotree (see the link above). I guess my explanation was quite fine, but in one case I incorrectly calculated the preconditions, which resulted in WA (223630659) and, subsequently, a huge mess and pain. It is still quite educational stuff though: the first half of the video is just a normal editorial (but, alas, with a technical mistake which should't screw the flow of the problem though), and the second one can teach you how to seek for bugs in problems like this one (with a big number of cases).
Also keep noted that for now the video is low-resolution. It will fix itself in half an hour or so. UPDUPD: the high resolution version has been processed and is available on YouTube.
Today I participated in Codeforces Round 887 (Div. 1). My experience was terrible (I wasn't able to solve 1852A - Набор Ntarsis during the contest, hope it tells you a lot), but it's still recorded, so hopefully it'll be useful for somebody. As usual, during the first half I participate while explaining aloud what and how I do, during the second part I explain more slowly the solutions of Div.1 problems A–D.
Note that the audio is quite high quality, and the high-quality video is coming in a couple of hours (Youtube is still processing it right now).
https://www.youtube.com/watch?v=2Dvi4WdFliM
UPD: The video now is high-quality.
Congratulations to Ormlis for taking the first place in a public Div. 1 Codeforces contest for the first time!
Название |
---|