awoo's blog

By awoo, history, 6 weeks ago, translation, In English

Neapolis University Pafos

Hello Codeforces!

The series of Educational Rounds continues thanks to the support of the Computer Science and Artificial Intelligence (CSAI) program at Neapolis University Pafos, with scholarships provided by JetBrains.

Educational Codeforces Round 188 (Rated for Div. 2) will start on Mar/16/2026 17:35 (Moscow time).

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-7 problems and 2 hours to solve them.

The problems were invented and prepared by Adilbek adedalic Dalabaev, Ivan BledDest Androsov, Maksim Neon Mescheryakov, Roman Roms Glazov, Alex fcspartakm Frolov and me. Also, huge thanks to Mike MikeMirzayanov Mirzayanov for great systems Polygon and Codeforces.

Good luck to all the participants!

Our friends at Neapolis University Pafos also have a message for you:

CSAI: First admission deadline approaches — April 28, 2026.

Apply for the BSc in Computer Science & Artificial Intelligence at the Neapolis University Pafos. Up to 40 full scholarships, provided by the JetBrains Foundation, are available this year.

Key Dates
  • Application Deadline: April 28, 2026, 11:59 pm UTC
  • Mandatory Entrance Test: May 3, 2026
A great opportunity: ACTS 2026.2 Camp

To improve skills and prepare for intense programs like CSAI, we encourage applying for the ACTS 2026.2 Camp in Germany (July 10-20, 2026).

  • Tracks: Competitive Programming and Software Engineering.
  • Registration Deadline: April 18th.

Ready to advance your coding journey? Join a leading computer science community today! Apply now and visit our dedicated pages for more details on how you can get involved.

UPD: Editorial is out

  • Vote: I like it
  • -17
  • Vote: I do not like it

»
6 weeks ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

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

»
6 weeks ago, hide # |
Rev. 3  
Vote: I like it 0 Vote: I do not like it

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

UPD: Success!!

»
6 weeks ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

Not that 6 — 7 problems joke again...

  • »
    »
    6 weeks ago, hide # ^ |
    Rev. 2  
    Vote: I like it +1 Vote: I do not like it

    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 weeks ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

GLHF!

»
6 weeks ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

i shall get stomped like the goombah i am

»
6 weeks ago, hide # |
 
Vote: I like it +6 Vote: I do not like it

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

»
6 weeks ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Good luck guys!

»
6 weeks ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

Hope to reach 1700

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 weeks ago, hide # |
Rev. 2  
Vote: I like it +1 Vote: I do not like it

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

UPD: its ok now

»
6 weeks ago, hide # |
Rev. 2  
Vote: I like it -31 Vote: I do not like it

what

»
6 weeks ago, hide # |
Rev. 2  
Vote: I like it +8 Vote: I do not like it

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

»
6 weeks ago, hide # |
 
Vote: I like it +17 Vote: I do not like it

InQforces ._.

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Now! A judge pause for at least 30 min.

»
6 weeks ago, hide # |
 
Vote: I like it +8 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it +39 Vote: I do not like it

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

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it +26 Vote: I do not like it

Speedforces&Queueforces

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

the queue was way too long mid contest

»
6 weeks ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

time to train Lagrange multipliers, I forgor how they work

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

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

»
6 weeks ago, hide # |
 
Vote: I like it +16 Vote: I do not like it

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 weeks ago, hide # ^ |
    Rev. 2  
    Vote: I like it +1 Vote: I do not like it

    Yeah if he is not an alt account for a LGM, then surely looks like he has, even maspy took 24 mins to solve G and this guy does in 8 mins

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

»
6 weeks ago, hide # |
 
Vote: I like it +15 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it +19 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it +2 Vote: I do not like it

Problem E edge cases cooked me bad.

  • »
    »
    6 weeks ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    There should not be any edge cases for the problem if you ignore/handle strings of length 1 separately.

    • »
      »
      »
      6 weeks ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      Yah my bad I thought "00001" something like this is allowed but only base case is "1","2",....,"9" . Again my bad for thinking S(x) can have leading 0 but since in x we remove leading 0 s(x) can't have it. So there can't be test cases like "0...01" or "10..0" as no vaid sol exist I think

    • »
      »
      »
      6 weeks ago, hide # ^ |
      Rev. 2  
      Vote: I like it 0 Vote: I do not like it

      can you tell me what am doing wrong if i just assume last digit as any number from 0 to 9 then propgate backwards ? the complexity will be 9*n? wouldnt it be?

»
6 weeks ago, hide # |
Rev. 4  
Vote: I like it 0 Vote: I do not like it

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 weeks ago, hide # ^ |
    Rev. 6  
    Vote: I like it +1 Vote: I do not like it

    pnq should be lcm(p, q), and qnr, rnp, pnqnr as well, lcm stands for least common multiply

»
6 weeks ago, hide # |
 
Vote: I like it +16 Vote: I do not like it

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

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

»
6 weeks ago, hide # |
 
Vote: I like it +9 Vote: I do not like it

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 weeks ago, hide # ^ |
     
    Vote: I like it +4 Vote: I do not like it

    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 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

how do u do e?

  • »
    »
    6 weeks ago, hide # ^ |
     
    Vote: I like it +2 Vote: I do not like it

    Think what can be the max value of second number appended?

  • »
    »
    6 weeks ago, hide # ^ |
     
    Vote: I like it +2 Vote: I do not like it

    Try all possible 2nd number. Then try to generate the suffix sequence. The 1st number must be from the remaining digits.

  • »
    »
    6 weeks ago, hide # ^ |
     
    Vote: I like it +2 Vote: I do not like it

    *the maximum number that can be appended in the second round is : sum of the digits of string. *the minimum number that can be appended in the second round is : sum of the digits of string-100. *iterate over this range. now you know the number appended in second round, you can find number appended in subsequent rounds. since you have used these numbers, erase it from the string. now the remaining digits of string should be the number 'x'. check whether its sum equals the number appended in second round. if it is equal then you got the answer. *to reduce the time complexity, don't actually erase from the string. instead make a vector of size 10 which will store the frequency of each digits, and then subtract from the frequency when the digits are used.

  • »
    »
    6 weeks ago, hide # ^ |
     
    Vote: I like it +1 Vote: I do not like it

    check my impl for e it is pretty cool and different https://mirror.codeforces.com/contest/2204/submission/367015032

    it works on the idea of brute force testing

»
6 weeks ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

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 weeks ago, hide # ^ |
     
    Vote: I like it +2 Vote: I do not like it

    Here's what I found after some Google search:

    Spoiler
    • »
      »
      »
      6 weeks ago, hide # ^ |
       
      Vote: I like it +1 Vote: I do not like it

      I use clang compiler on my PC, so yeah that may be the cause. Maybe I should avoid using library call like sscanf and sprintf next time if possible(?)

      • »
        »
        »
        »
        6 weeks ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        I don't think using it for string is a bad idea, but using arithmetic op on it might not be very efficient.

»
6 weeks ago, hide # |
 
Vote: I like it +47 Vote: I do not like it

felt like a div3

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 weeks ago, hide # ^ |
    Rev. 3  
    Vote: I like it +8 Vote: I do not like it

    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 weeks ago, hide # ^ |
     
    Vote: I like it +25 Vote: I do not like it

    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 weeks ago, hide # |
Rev. 2  
Vote: I like it +21 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

felt like a div2

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it -6 Vote: I do not like it

Hello guyz!

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it +7 Vote: I do not like it

I really enjoyed the problem E :)

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 weeks ago, hide # ^ |
    Rev. 3  
    Vote: I like it +1 Vote: I do not like it

    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 weeks ago, hide # |
Rev. 3  
Vote: I like it +41 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Is the contest converted to unrated??

  • »
    »
    6 weeks ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    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 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

cool

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Any hints on G?

  • »
    »
    6 weeks ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it
    Hint 1
    Hint 2
    Hint 3
»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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

»
6 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

awoo Can we have the editorial please.

»
6 weeks ago, hide # |
Rev. 2  
Vote: I like it +3 Vote: I do not like it

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

  • »
    »
    6 weeks ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    No, it happens because the ratings for the round are not updated. As soon as the ratings are updated it will appear in the rated section

»
6 weeks ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

Why the Ratings are still not updated yet ?

»
5 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

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 weeks ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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 weeks ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

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