Hello I want to create a new team with people outside my network for the team competitions in future. If you are interested then please let me know in the comment section:)
Hello I want to create a new team with people outside my network for the team competitions in future. If you are interested then please let me know in the comment section:)
So now that part of the year coming close when everyone can become a Legendary Grandmaster ^-^
Btw which color you will be trying this time :)
SecondThread, please look into this issue.
As we know that Meta HackerCup season 2025 has started and practice contest is already going on.
Today, I was solving the A problem i.e., WARM UP
I validated the output and it matched successfully ✅
Then after downloading zip file for main test case input, I created output file properly and submitted it but then it showed me something like this :
I tried 4-5 times but it kept showing the same thing and then timer clocked out !!!!
SecondThread can you please clarify about this issue. This was just a practice contest but if same thing happens in Round 1, then Where to go for this issue?
UPD:- Problem for specific submission is sorted out ✅ (SecondThread Thanks !!)
How many distinct ways can you color the vertices of a square using 3 colors, considering rotational symmetry?
If you said 3⁴ = 81, you're ignoring symmetry.
If you said 81 / 4 = 20.25, well... you're ignoring math.
In this blog, I will dive deep into Burnside’s Lemma and the Polya Enumeration Theorem – two powerful tools in counting under symmetry, often underused in Competitive Programming.
Suppose, you’re given n beads on a circular necklace. You can color each bead with k colors.
How many distinct colorings exist, considering that rotating the necklace doesn't change its appearance?
Brute force? Exponential.
Naive formulas? Won’t work.
This is where group actions and Burnside’s Lemma step in.
Now Let's suppose, you have a square with 4 vertices. You want to color each vertex with 3 colors.
But two colorings are considered the same if one can be rotated to get the other.
There are 4 rotational symmetries of a square:
| Rotation | Description |
|---|---|
| g₀ | 0° (identity) |
| g₁ | 90° clockwise |
| g₂ | 180° |
| g₃ | 270° clockwise |
So, |G| = 4
Let’s denote the number of colors as k = 3.
For each rotation, we count the number of colorings that remain unchanged after the rotation:
| Rotation | Cycles induced by rotation | Fix(g) |
|---|---|---|
| g₀ | (1)(2)(3)(4) | 3⁴ = 81 |
| g₁ | (1→2→3→4→1) | 3¹ = 3 |
| g₂ | (1↔3)(2↔4) | 3² = 9 |
| g₃ | Same as g₁ | 3¹ = 3 |
Total distinct colorings:
= (1/4) * (81 + 3 + 9 + 3) = (1/4) * 96 = 24 So the answer is 24 distinct colorings, not 81.
Burnside gives us the idea — Polya gives us the formula.
Let’s Suppose say we want to count the number of ways to color n beads on a circular necklace using k colors, modulo rotations.
In circular rotation, the group G has n elements: rotation by 0, 1, ..., n−1 positions.
For each rotation by r, the number of cycles it induces is gcd(n, r).
So the number of distinct colorings is:
I was solving Train and Queries and my submission 190745271 got TLE in test case 19(I know space complexity is bad but it's beacuse i wanted to solve it with priority queue only). I was calculating time complexity of my code again and again but it was all ok in code according to me because i was considering time complexity of operations of hashmap O(1) ( which is true for most of the cases) . Then i watched tutorial and seen the same core approach as mine,but i didn't copy that solution because i wanted to know what was wrong in my code. Then i noticed 18th test case(previous one of the failed test case) and that test case passed by using same size of array and number of queries that of failed test case. Then i came to know that TLE is not because of size of array and number of queries,instead it's due to elements of the array and then had intuition that there is something wrong with hashmap and i searched for it and then i found a valuable blog of neal (Blowing up Unordered_map) . Really it was so intresting and filled with deep topics. Then i came to know that 19th test case was blowing up my hashmap and i changed hashmap to tree map in submission 190747739 . Bingo ! it passed all test cases. More than solving a problem i learnt such an intresting topic today . A special thanks to neal .