Tabriz-Talayi's blog

By Tabriz-Talayi, history, 3 hours ago, In English

Context:
I recently learnt MST and reached this problem (609E - Minimum spanning tree for each edge). I was stuck on it for like 2 days, and I only managed to come up with an $$$O(m\log m + mn)$$$ solution, which will obviously TLE. I decided to read some of my teachers'/friends'/top coders' codes to get some idea, but they all used some kind of heavy algorithm I haven't learnt yet (mostly LCA). I was ready to give up on the problem; I decided to hand-run the current algorithm I had one more time to look for improvements before giving up, and fortunately during hand-running I noticed a key property in the Kruskal algorithm which led to me coming up with an extremely clean sol.
It solves the problem in $$$O(m\log m + (n + m\log n)\log n)$$$ and uses the core Kruskal Algorithm plus a vector-based StoL DSU.
IDK if this is a well-known property or not, but after checking some submissions, I'm sure it's not a well-known approach for this problem.


The Property

Full Solution
Implementation

I'm new to CP and hand-wrote everything myself (I used AI just for notation and capitalization and stuff), so if anyone has a better way of explaining than I do, or if some of what I said is wrong or needs editing, please let me know and I will edit the blog to bring it up to standard.

Full text and comments »

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

By Tabriz-Talayi, 4 months ago, In English

If you haven’t been living under a rock, you probably know there’s an ongoing conflict involving Iran and the US, and Iran has been under a near-total internet blackout.

and im an informatics student in Iran :(

For a while, having internet access was basically impossible. After the ceasefire, people could only get online by paying around $30–50 for just 5 GB of internet. (Keep in mind that the average monthly income in Iran is about $300–500.)

So yeah, I was practically selling an arm and a leg just to get online and just look at the codeforces website (super fun!).

Until recently, internet access was mostly limited to government people + their friends/families. Around two weeks ago, they started giving limited access to college professors, businessmen, and doctors.and they called it “Pro Internet”. yes, literally a subscription for internet where practically nobody could buy it even if they wanted to, and you have to be selected just to pay for it, and even then you still can access the full internet. (dont you wanna be in iran rn?)

Because my parents are doctors, I was lucky enough to finally try this “Pro Internet.” by being among the selected few and still paying about $2 per 5 GB, you get limited access to certain websites and Telegram (again, super fun!).

So after getting incredibly lucky, I finally stopped paying absurd amounts for VPNs and started using this Pro Internet just for Codeforces.

Now fast forward to today’s contest.

I start the contest, submit Problem A, and immediately my internet dies. Two minutes later it comes back, I submit A again… and it dies again. this time it doesn’t come back.

After waiting 15 minutes, I finally decide to go buy one of those $30 VPNs again. I wait for the seller to activate my account, waste even more time, finally get online, and start solving B. I come up with a solution pretty quickly and submit it, thats when i realize i forgot to check whether A was even accepted.

Because of my immense luck, the moment I open the submission page, my internet dies AGAIN (having the time of my life btw). I message the VPN seller, no response. Then suddenly my Pro Internet comes back. I fix my A solution, go back to B, submit it… and the internet dies AGAINNNN.

Then the VPN comes back on. (with alot of praying btw)

like come on, mannnn. I might be low rated, but Im still a human and still care about my progress.

The main goal of this rant was honestly just to vent my frustration, but also maybe to encourage people to be a little nicer when talking to Iranians on Codeforces.

Full text and comments »

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