Блог пользователя awoo

Автор awoo, история, 6 недель назад, По-русски

Neapolis University Pafos

Привет, Codeforces!

Серия образовательных раундов продолжается благодаря поддержке программы Computer Science and Artificial Intelligence (CSAI) в Neapolis University Pafos со стипендиями от компании JetBrains.

В Mar/16/2026 17:35 (Moscow time) состоится Educational Codeforces Round 188 (Rated for Div. 2).

Этот раунд будет рейтинговым для участников с рейтингом менее 2100. Соревнование будет проводиться по немного расширенным правилам ICPC. Штраф за каждую неверную посылку до посылки, являющейся полным решением, равен 10 минутам. После окончания раунда будет период времени длительностью в 12 часов, в течение которого вы можете попробовать взломать абсолютно любое решение (в том числе свое). Причем исходный код будет предоставлен не только для чтения, но и для копирования.

Вам будет предложено 6-7 задач на 2 часа. Мы надеемся, что вам они покажутся интересными.

Задачи вместе со мной придумывали и готовили Адилбек adedalic Далабаев, Иван BledDest Андросов, Максим Neon Мещеряков, Роман Roms Глазов и Александр fcspartakm Фролов. Также большое спасибо Михаилу MikeMirzayanov Мирзаянову за системы Polygon и Codeforces.

Желаем удачи в раунде и успешных решений!

Наши друзья из Neapolis University Pafos хотят поделится с вами важной информацией:

CSAI: приближается первый срок подачи заявок — 28 апреля 2026 года.

Подайте заявку на программу бакалавриата по компьютерным наукам и искусственному интеллекту в Neapolis University Pafos. В этом году будет выделено до 40 полных стипендий, предоставляемых JetBrains Foundation.

Ключевые даты
  • Крайний срок подачи заявки: 28 апреля 2026 года, 23:59 UTC
  • Обязательный вступительный тест: 3 мая 2026 года
Отличная возможность: летняя школа подготовки ACTS 2026.2

Чтобы улучшить свои навыки и подготовиться к интенсивным программам, таким как CSAI, мы рекомендуем подать заявку на летнюю школу ACTS 2026.2 в Германии (10–20 июля 2026 года).

  • Направления: Спортивное программирование (Competitive Programming) и Программная инженерия (Software Engineering)
  • Крайний срок регистрации: 18 апреля.

Готовы развить свои навыки программирования? Присоединяйтесь к одному из ведущих сообществ в области компьютерных наук уже сегодня! Подайте заявку и посетите наш сайт, чтобы узнать все подробности.

UPD: Разбор опубликован

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

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Auto comment: topic has been updated by chillingjellyfish (previous revision, new revision, compare).

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Автокомментарий: текст был обновлен пользователем chillingjellyfish (предыдущая версия, новая версия, сравнить).

»
6 недель назад, скрыть # |
Rev. 3  
Проголосовать: нравится 0 Проголосовать: не нравится

Hope I can become Master in this round :) (I failed last time)

UPD: Success!!

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

Not that 6 — 7 problems joke again...

  • »
    »
    6 недель назад, скрыть # ^ |
    Rev. 2  
    Проголосовать: нравится +1 Проголосовать: не нравится

    Python: while True: print(67)

    C++:

    include

    int main() { while (true) { std::cout << 67 << std::endl; } return 0; }

    Java: public class ImprimirEternament { public static void main(String[] args) { while (true) { System.out.println(67); } } }

    C:

    include <stdio.h>

    int main() { while (1) { printf("%d\n", 67); } return 0; }

    Haskell: main :: IO () main = mapM_ print (repeat 67)

    Assembly: section .data msg db '67', 10

    section .text global _start

    _start: mov rax, 1 mov rdi, 1 mov rsi, msg mov rdx, 3 syscall jmp _start

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

GLHF!

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

i shall get stomped like the goombah i am

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Let's see how this goes!

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +6 Проголосовать: не нравится

Hope to don't lose my Specialist, please......

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Good luck guys!

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

What is the difference between educational round and regular round other than scoring system? Is the problem "easier" and more "training" like than regular round?

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

Hope to reach 1700

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

i thought it was on russian till i saw that was translated

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I absolutely HATE people who reply with "what". Seriously, are you a runtime error? A segfault in the human language compiler? Imagine spending your precious CPU cycles crafting a beautiful explanation, laying out your thoughts with the clarity of a competitive programmer optimizing their bitsets, and the only response you get is "what".

Like, excuse me, is your brain currently experiencing buffer overflow? Did you accidentally AND your listening skills with zero? Maybe if I rephrased this explanation as a Codeforces editorial starring your beloved bitset waifu, you'd suddenly comprehend everything. Honestly, next time someone hits me with a "what," I'll just reply, "Sorry, buddy, didn't know your attention span had a time complexity of O(1)."

Do better.

»
6 недель назад, скрыть # |
Rev. 2  
Проголосовать: нравится +1 Проголосовать: не нравится

Why is the writer list on the contest page still empty so far

UPD: its ok now

»
6 недель назад, скрыть # |
Rev. 2  
Проголосовать: нравится -31 Проголосовать: не нравится

what

»
6 недель назад, скрыть # |
Rev. 2  
Проголосовать: нравится +8 Проголосовать: не нравится

What happen? A judge pause for at least 10 min.

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +17 Проголосовать: не нравится

InQforces ._.

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Can any1 check the server pls??

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Now! A judge pause for at least 30 min.

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +8 Проголосовать: не нравится

My submission was queued and got processed after 17 minutes and after 17 minutes I got to know I have submitted code for D in B problem. Queued again LOL

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +39 Проголосовать: не нравится

Is it just me, or does statement D kind of suck? (It’s written really unclearly)

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

problem tells you: take a number, write its digits, add its digits, repeat until it becomes a single number… now arrange all the digits so the result of the magic game becomes some number..meh does that mean math or magic?nobody understands... but actually, nice contest, it's the first time problem D didn’t risk your rating.

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +26 Проголосовать: не нравится

Speedforces&Queueforces

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

the queue was way too long mid contest

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +3 Проголосовать: не нравится

time to train Lagrange multipliers, I forgor how they work

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

In problem D, for each component is it not enough to simply check if there's an odd length cycle? Iff not, add by x/2, where x is the number of nodes in the component.

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +4 Проголосовать: не нравится

How did so many people solved D?? was it so easy? Even after solving 3 problems(acd) my ranking is like 9k

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

There are sooo many cheaters. For instance, I am quite sure that sonsimpmiku cheated, who got every problems accepted in just 35 minutes. That's incredible.

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve C..I tried but WA 367013755 here is my submission after contest... What i am doing wrong!

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

i don't understand what even question 4 is saying .

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +15 Проголосовать: не нравится

I am depressed , it was my birthday today and I solved three in 25 mins saw 1k rank thought inflation would yield 2k rank but getting 5k at end has made my day bad... is D that easy , i was unable to even understand test cases

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +19 Проголосовать: не нравится

Why is D's statement so unclear? I don't think problem statement language is supposed to be the bigger hurdle in a div2D.

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +2 Проголосовать: не нравится

Problem E edge cases cooked me bad.

»
6 недель назад, скрыть # |
Rev. 4  
Проголосовать: нравится 0 Проголосовать: не нравится

plz help me finding flaw in my logic in problem C...

#include <bits/stdc++.h>

using i64 = long long;
using u64 = unsigned long long;

#define endl '\n'

using namespace std;

void solve() {
  i64 p, q, r, n;
  cin >> p >> q >> r >> n;

  i64 onlyp = n / p;
  i64 onlyq = n / q;
  i64 onlyr = n / r;

  i64 pnq = onlyp / (p * q);
  i64 qnr = onlyq / (q * r);
  i64 rnp = onlyr / (r * p);

  i64 pnqnr = n / (p * q * r);

  i64 ansp = (onlyp - rnp - pnq + 2 * pnqnr) * 6 + (rnp + pnq - 2 * pnqnr) * 3 +
             (pnqnr) * 2;

  cout << ansp << endl;
}

int main() {

  ios::sync_with_stdio(false);
  cin.tie(nullptr);

  int t;
  cin >> t;
  while (t--) {
    solve();
  }

  return 0;
}
»
6 недель назад, скрыть # |
 
Проголосовать: нравится +16 Проголосовать: не нравится

Screencast with commentary (once YouTube is done with processing it)

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Preventing $$$O(n log$$$$$$2$$$$$$n)$$$ solutions in F feels unnecessary.

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +9 Проголосовать: не нравится

You cannot simply turn a forest graph into a general simple graph in the middle of the round :(

That's too critical to do so and I wonder how this had not been noticed before the round started.

  • »
    »
    6 недель назад, скрыть # ^ |
     
    Проголосовать: нравится +4 Проголосовать: не нравится

    If I remember correctly, english statement changed from "Call a vertex v beautiful if any paths" to "Call a vertex v beautiful if all paths" in the middle of the contest.

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

how do u do e?

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

For problem E: Today I learned that using sscanf ("str" -> "int") and sprintf ("int" -> "str") to a short temporary buffer_string and do string manipulation is slow (TLE:367013757) on codeforces machine and better do manipulation on the integer directly: (AC:367016186)! Though that's not the case on my PC:

weird x_x"

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

https://mirror.codeforces.com/profile/Ser_arthur Ser_arthur it looks is cheating , a newbie unrated who just joined and is in top guys in standing

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +47 Проголосовать: не нравится

felt like a div3

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

It looks like https://mirror.codeforces.com/profile/Ser_arthur Ser_arthur cheated, unrated guy who just joined some days ago is already in top standings !! and did all!! *

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Pretty nice E and F, but imo E should be D and F should be E

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

for problem D is this sequence valid? 1 --> 2 <-- 3 --> 1 for test case 1 3 3 1 2 2 3 1 3

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I find it interesting that 366982885 gets rte, but 367037092 passes. The only difference is allocating the large arrays on stack / heap. (Had to wait 20 min during the contest to find out)

  • »
    »
    6 недель назад, скрыть # ^ |
    Rev. 3  
    Проголосовать: нравится +8 Проголосовать: не нравится

    Same thing happened with me on a onsite contest i couldn't figure out why. after the contest i found out vector<int> graph[n] was the culprit changing this to vector<vector<int> > graph(n) gave ac.after that day i never use 2d vector that way

  • »
    »
    6 недель назад, скрыть # ^ |
     
    Проголосовать: нравится +25 Проголосовать: не нравится

    For C++, the stack size is limited to 256MB, regardless of the memory limit of the problem (this number is hardcoded in the compiler command-line options).

    You put the following things on stack:

    • int c[N][10], which takes ~38MB.
    • vector<int> p[N*10], which takes ~228MB (because sizeof(vector<int>) is 24).

    They are more than 256MB in total, so you have stack overflow.

»
6 недель назад, скрыть # |
Rev. 2  
Проголосовать: нравится +21 Проголосовать: не нравится

Won't we talk about cheaters ? It is really frustrating, they affect the contest rating changes and this is not a fair play. I hope you do something about it

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

This time the tasks were easier than I thought.

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

felt like a div2

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

How to solve F? If we had only one k, then the greedy approach is to choose always one element in a subarray, more precisely element with smallest value of a[i], then decrease it until it becomes 1/1, then increase numerator. We can calculate for each element it's contribution. But how to solve this problem for many k's?

»
6 недель назад, скрыть # |
 
Проголосовать: нравится -6 Проголосовать: не нравится

Hello guyz!

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

man e was such an easy solution idk why i got stuck on attempting brute force as last digit assuming last digit can be anything from 1-9 and then proceeded backward propagation man fml

»
6 недель назад, скрыть # |
 
Проголосовать: нравится +7 Проголосовать: не нравится

I really enjoyed the problem E :)

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

My thought process for Problem E is as follows :

The result number should have this form : x_sum_digit(x)_sum_digit(sum_digit(x))_ ... Let's call it v1_v2_v3_...

We can see that v2 <= max(|S|) * 9 = 1e5 * 9. => WE CAN BRUTE-FORCE the value of v2 !!! (Since the problem state that total of |S| in testcases <= 1e5)

I noticed that if we have the value of v2, we can construct v3, v4, ... all to the end.

And, after all of this, we obtain the total frequent of the digits in v2, v3, v4, ... and then use this to construct v1 (the original number — x) from what we have left.

For example, testcase 1 with the string "12735"

We brute force till v2 = 12 => construct v3 = sum_digit(v2) = 3 (since 3 <= 9 so we stop) At this point, the remaining digits are freq['7'] = 1 and freq['5'] = 1. We can easily check if the number 75 or 57 do the thing (here both answers are accepted, so i assume we select 75)

  • »
    »
    6 недель назад, скрыть # ^ |
    Rev. 3  
    Проголосовать: нравится +1 Проголосовать: не нравится

    You only need to search v2 in this range: max(1, sum_digit(input)-70) <= v2 <= sum_digit(input) and brute force the rest without pre-compute anything:

    Example Code: 367072645

    The idea appear just now, before that I pre-compute all possible v2 in range: 1 <= v2 <= 999999 and do reverse table lookup for all possible v2 given sum_digit(input):

    More complicated code (using larger than 110 MiB of memory): 367056743

»
6 недель назад, скрыть # |
Rev. 3  
Проголосовать: нравится +41 Проголосовать: не нравится

Please check the hack https://mirror.codeforces.com/contest/2204/hacks/1170230

This hack is invalid because the number 11 does not belong to any S(x), while the test data has unexpectedly passed the validator's check.

Take a look please. awoo adedalic BledDest Neon Roms fcspartakm

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Is the contest converted to unrated??

  • »
    »
    6 недель назад, скрыть # ^ |
     
    Проголосовать: нравится 0 Проголосовать: не нравится

    I think "unrated allowed" means that participants can choose between rated and unrated participation during registration.

    • If a participant selects rated, their performance will affect their rating [increase or decrease].

    • If a participant selects unrated, their rating will remain unchanged, regardless of performance [even if they solve no problems or get wrong answers].

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

cool

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

cool

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Any hints on G?

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Why is the system test stuck at fifty-three percent?

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

awoo Can we have the editorial please.

»
6 недель назад, скрыть # |
Rev. 2  
Проголосовать: нравится +3 Проголосовать: не нравится

is this unrated for all? in contests when i select rate it appears none, but in unrated this appears!

»
6 недель назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Why the Ratings are still not updated yet ?

»
6 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

☆*: .。. o(≧▽≦)o .。.:*☆

»
5 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

My submission for Problem D was flagged for similarity with a cluster of other solutions. I would like to state that I wrote this solution independently during the contest. The code uses a very standard bipartite coloring approach, and identifiers like col, ans, and cnt are common abbreviations that I regularly use in my own submissions. Because the solution is straightforward, I can understand how multiple independent implementations may end up looking similar. Nevertheless, I did not copy from any person, source, or publicly available code. I respectfully request a manual review, as I believe this is a false positive.

»
5 недель назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

I received a message about solution 366974046 coinciding with others for problem 2204D. This problem is a standard bipartite coloring problem. The solution follows a common template that I have used before. I did not share my code, nor did I use a public IDE during the contest.I used VScode locally. The similarity is due to the problem being classic, not due to any violation. If needed, I can provide more details. Thank you.

»
5 недель назад, скрыть # |
 
Проголосовать: нравится +1 Проголосовать: не нравится

Hii Codeforces Team I got a message from your side regarding my submission:367003879 for the problem 2204D. As I have studied Graphs from take U forward (Striver) channel on YouTube from this playlist https://www.youtube.com/playlist?list=PLgUwDviBIf0oE3gA41TKO2H5bHpPd7fzn. In whole playlist he has completed many different kind of question possible. And one of the question was on Bipartite graphs in this playlist which I have done earlier. And question 2204D was similar to that which is very standard type of question. I have written the whole code my myself and has not taken from any source. That's why I was able to do that question during the contest. I assure you that I am giving contests on Codeforces for a long time and have never violated any rule and will also not violate any rule in upcoming contests. So I kindly request you to review my submission manually and remove the warning from my submission. Regards

»
5 недель назад, скрыть # |
Rev. 2  
Проголосовать: нравится 0 Проголосовать: не нравится

Hello Codeforces Team, my submission (ID: 366976578) for problem 2204D was flagged for similarity. I would like to clarify that I wrote the solution independently during the contest. The task is a standard bipartite graph check, which naturally leads to very similar implementations across participants. I was already familiar with this algorithm from common resources like GeeksforGeeks (https://www.geeksforgeeks.org/dsa/bipartite-graph/) and cp-algorithms (https://cp-algorithms.com/graph/bipartite-check.html. I believe this is a false positive and kindly request a manual review.

»
5 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Hello,

I am writing regarding the notification about the coincidence of my solution for problem 2204E with other participants.

I want to clarify that I did not intentionally share my code. It appears that my younger brother accessed my computer while I was away and copied the source code without my permission. I realize now that leaving my workstation unlocked was a mistake on my part, even in a home environment.

I have already taken strict measures to ensure this never happens again, including locking my computer every time I step away. I value the community and the rules of Codeforces and ask you to consider this a one-time unintentional leak.

Thank you for your understanding.

»
5 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Hello Codeforces team, I received a warning regarding my submission 366977261 for problem 2204D. I want to clarify that I did not copy code from any participant and did not use any public code-sharing platforms such as ideone. The idea I used is simply a bipartite graph check using BFS/DFS coloring, which is a standard approach and also appears in the well-known problem https://leetcode.com/problems/is-graph-bipartite/description/ (LeetCode 785) on LeetCode. Because this algorithm is very common, many implementations may look similar. I kindly request a manual review of my submission. Thank you.

»
5 недель назад, скрыть # |
Rev. 4  
Проголосовать: нравится 0 Проголосовать: не нравится

Я получил уведомление о том, что я списывал задачи D и F у [user:Ityahanser]. Хочу заявить, что я действовал честно и не списывал.

  • Геолокация: Я не знаком с [user:Ityahanser]. Мы живем в разных странах (Россия и Китай).
  • Изолированность от сети: Я писал код офлайн в редакторе CP Editor на своем компьютере, это видно по комментариям в начале каждой посылки. Поэтому списывание не могло произойти случайно.
  • Реальная схожесть кода: Наш код ни капли не похож, идеи используемые в наших реализациях весьма популярны и изъезженны, особенно учитывая то, что это — Educational.

Я никогда не нарушал правила раундов Codeforces, прошу пересмотреть решение.

»
5 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

Hello! I want to appeal my D and F submissions.

At first, the user that has similar solve is from China, probability that I know any chinese people are low because I'm Russian.

At second, I've been used offline CP editor (you can see it in my comments before every task).

At third: this is Educational round and in my submissions I've used very popular ideas, they may be similar to another people ideas and this wouldnt mean im cheating.

Please review my submission manually.

»
5 недель назад, скрыть # |
 
Проголосовать: нравится 0 Проголосовать: не нравится

I received a message about my solution 366984844 coinciding with some others for problem 2204D. This problem is a standard bipartite coloring problem and is therefore expected to have similarities with other users (especially considering that there are common templates for bipartite coloring). I did not share my code, nor did I use a public IDE during the contest.I used Code Blocks locally. The similarity is likely due to the problem being classic, not due to violation. If needed, I can provide more details to support this claim. Kindly check ASAP