Arpa's blog

By Arpa, history, 6 days ago, In English

I just returned from the 1st edition of the GoForGold camp in India 🇮🇳, where I had the privilege of teaching some of the brightest Indian students as they prepare for the upcoming ICPC World Finals.

After organizing camps in Syria, Uzbekistan, Azerbaijan, and Croatia, this was yet another incredible experience of helping students push closer to their competitive programming goals.

A highlight of this trip was witnessing the unique approach of Newton School of Technology. They brought teachers right from industry to university to fill the gap — a truly innovative structure that left a lasting impression.

Congratulations to the top three winners in Div. 1:
🥇 404_solution_not_found: P.V.Sekhar, sai-17, nishkarsh
🥈 poocha kya: _helloLad, Atekichan, sv1shan
🥉 SoloTree: Dragokj03, Divine_Spark, evenvalue



Camp was held for 7 days, including a leisure day. Every day participants started their morning with a contest, which I selected for Div 1. I spent four days teaching first-division classes and two days teaching second-division classes. acraider and Dominater069 also covered the remaining two days of the first-division classes. I covered the following topics in lecture sessions: Sack, HLD, FFT, NTT, Network Flow, Treap, Geometry, and Game Theory. Also, I held the post-contest discussions.

On the first day, I told the students "You should die at the end of the camp" and they approved on the last day that they reached the goal I set for them. We grow under pressure, and a camp is the place to train under pressure. Every day having contests, post-contest discussions, and lecture sessions creates a high pressure that leads to incredible growth. I also experienced the same situation in the Moscow camp in 2020.

There are countless people to thank, but I’d especially like to express my gratitude to Deepak Enigma27 Gour for inviting me and the Newton School of Technology for their warm hospitality.

Full text and comments »

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

By Arpa, history, 4 weeks ago, In English

Hey there!

Thank you for being part of the ICPC India Prelims 2024! 🚀

I've put together hints and solutions for the problems to help you reflect on the challenges. As the contest admin, I even recorded myself solving the problems live — it's a mix of strategy, insights, and a behind-the-scenes look at my thought process.

🎥 Watch the video here: https://youtu.be/NsIj7CgDPY8

Let me know what you think, and feel free to share your thoughts or questions! 😊

The problems are ordered from easy to hard.

Unsatisfying Array

Hint
Solution

AND Quest

Hint
Solution

Small Indices

Hint
Solution

Yet Another GCD Problem

Hint
Solution

Equations

Hint
Solution

Update:

I'm sorry about what happened in the ICPC prelims. The problems passed to me just 10 hours before the contest. As you can see in the video almost all the time I was just engaged with solving them. The time was such tight that I was occupied with just solving the problems to finish them before the contest started. I didn't have any time to test.

I know that the organizers are making a decision that will make everyone happy.

Full text and comments »

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

By Arpa, 2 months ago, In English

Salam, Codeforces!

On behalf of Sharif University of Technology, we are thrilled to invite you to the Rayan Programming Contest 2024!

The contest will feature three exciting rounds:

  1. Warm-Up Round: Will be started on November 12, 2024. You can participate here.
  2. Selection Round: Scheduled for November 30, 2024, as a rated Div. 1 + Div. 2 contest.
  3. Final Round: The grand finale will take place onsite in Tehran in Spring 2025.

Prizes

  • A total prize pool of $40,000 for the Final Round winners!
  • 50 exclusive T-shirts for participants in the Selection Round.

We would like to express our gratitude to:

  • MikeMirzayanov for making this event possible.
  • KAN for his dedicated coordination efforts.
  • The Rayan team for organizing the contest.

Looking forward to seeing you in the upcoming rounds!

More information can be found at rayan.global.

Best of luck,
Rayan Programming Contest Team

Full text and comments »

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

By Arpa, history, 2 months ago, In English

It has been a year since our brothers and sisters in Palestine have been dying and watching their families die. With the war in Lebanon also unfolding, I wondered what I could do.
We, Algoritmi Academy, want to do the least we can to support people there. We sincerely apologize for not acting sooner.

Starting now, we will hold free weekly classes for Palestinian and Lebanese coders. Our priority will be those preparing for IOI and ICPC, but we may accept coders preparing for other goals.

To participate, register on our website and select group classes.

Our activities are not limited to one class per week; we’ll also have a monthly contest. If the number of participants grows, we’ll make two divisions to better maintain the level. For those who may struggle with English, mention it in your registration form; we may hold some classes in Arabic, too.

And finally, we want to send your strong, but injured heart a healing:

«أُذِنَ لِلَّذِينَ يُقَاتَلُونَ بِأَنَّهُمْ ظُلِمُوا وَإِنَّ اللَّهَ عَلَىٰ نَصْرِهِمْ لَقَدِيرٌ»
Those who are fought against are permitted to defend themselves because they have been wronged, and God is indeed able to help them

Sincerely to all the resilient and unyielding Palestinian and Lebanese people, The Algoritmi Academy team:

Full text and comments »

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

By Arpa, history, 3 months ago, In English
CF ratings are unrelated to your IOI results. CF contests differ significantly from IOI contests.

Wrong!

A higher CF rating, with a gap of at least 100, correlates with an 87% chance of achieving a better placement at IOI. In fact, the relationship between IOI placement and CF rating is strongly connected. The Pierson Correlation Coefficient for these two factors is -0.83.


Correlation between CF rating and IOI placement

❗ What is that outlier participant on the top-right? He is Jiyu Shen (PubabaOnO), with CF rating of 3000+, but it seems that he was unable to attend the contest 💔

Here are the statistics on CF ratings for each medal:

Medal Minimum Median
🥇 2029 2469
🥈 1501 2274
🥉 1637 2082

Additionally, I've discovered an interesting correlation: participants' ratings one year before IOI also correlate with their final ranks. By the way, some participants showed remarkable jumps in their ratings during that one-year period. Specifically, there were 4 participants with 1000+ growth in CF rating!



Correlation between CF rating a year before IOI and IOI placement

Based on this insight, I’ve trained a model that can predict your placement at IOI. If you’re curious about your predicted placement for IOI 2025, leave a comment! Note that as time passes, the model can determine your place more accurately. So you may comment again 6 months later to see the updated prediction.

Check out the similar blog for IOI 2019 here.

Full text and comments »

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

By Arpa, history, 3 months ago, In English

Hey everyone!

I’ve just returned from an incredible 13-day journey in Croatia, where I had the pleasure of being a part of OCPC 2024 Fall as the editorialist. It was an exhilarating experience to lead editorial sessions after each contest.



Explaining the solution to a problem while one of the participants is checking the distance to the river beach. :broken-heart:

The problem sets were amazing — I truly enjoyed them all. They took me back to my time at the Moscow Camp 2020, evoking the same excitement and challenge of solving numerous problems under time pressure. It was a refreshing and rewarding experience, especially since I don’t compete as frequently these days. After my World Finals in 2021, I semi-retired from competitive programming, shifting my focus to coaching instead: Algoritmi Academy. Now, I only compete a few times a year, so getting to dive deep into this environment again was a real pleasure.



While in Croatia, I also made sure to explore the beautiful landscapes. I rented a car and embarked on a breathtaking drive through the winding roads to Plitvice Lakes, and then onwards to the stunning Croatian coastline. It was a once-in-a-lifetime experience, filled with natural beauty and unforgettable moments.

Congratulations to the first team: Singapore Legged Forces: first place cheated (Wailydest, errorgorn, 244mhq). A huge thank you to OCPC, and of course, a special thanks to adamant and -is-this-fft- for the invitation — it was an honor to be part of this event.

Also read: adamant blog on this.

Watch editorial session for the eighth day contest contest: Link.

Full text and comments »

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

By Arpa, history, 4 months ago, In English

Welcome to the second part of our series on using CLion for competitive programming.

After our first blog post, we received helpful feedback that we’ll address here. We aim to keep our videos short and to the point, so we’ll cover more details and respond to comments in the blog.

Watch

Our goal is to create high-quality content for competitive programming, and we value your support and feedback in helping us reach this goal.

Once we’ve covered the IDE topics, we’ll move on to more in-depth content on algorithms, strategies, and problem-solving.

Addressing Your Feedback


I feel Vim is better than an IDE.
Compare to VSCode
Genuine question: How do you ensure the IDE you use is also available at on-site contests?

Full text and comments »

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

By Arpa, history, 6 months ago, In English

Hey folks!

Choosing an efficient IDE or editor is a common concern in competitive programming and other programming areas. There are also a lot of Codeforces blogs about that. Many of my students always ask me about this matter, so I created some content on this concern. I also encourage others to do the same and show the features of the IDE/Editor they are currently using.

After 10 years of experience and examining a lot of editors and IDEs, I am using CLion today. As you may know, CLion is an IDE by JetBrains. They also have IDEs with the same features and shortcuts for other languages like Java (IntelliJ) and Python (Pycharm).

There are two main reasons people try to avoid JetBrains (or similar IDEs):

  1. The first one is that they are usually not free.
  2. The second one is that they are slow.

For the first one, note that if you are a student, you can access the student version of JetBrains. For the second one, follow me to see why they are worth it.

The advantages of using an IDE include numerous shortcuts that speed up your coding (which you can see in the video linked below). Another advantage is that they assist you in debugging. They can also catch compile errors and warnings before compiling! There are many other benefits that we will discuss soon.

Watch: https://www.youtube.com/watch?v=kd7-YG-xLVo

Full text and comments »

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

By Arpa, history, 6 months ago, In English

Hey Codeforces!

If you do competitive programming with C++ or use C++ in other areas, you should definitely check out my latest YouTube video on Google Sanitizers. These tools will help you catch bugs and improve your code quality!

Watch now

Happy coding!

Full text and comments »

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

By Arpa, history, 10 months ago, In English

Hello again, Codeforces Community,

We are back and thrilled to announce the official launch of our group classes! Following your valuable feedback from our first announcement, we've defined our rules for group classes.

We're excited to offer a special 30% discount on all group classes for one week only! Check out these fantastic rates:

  • 2-student class: $42, now $30 per session
  • 3-student class: $35, now $25 per session

Here's the best part: our unique group class program allows for individual registration. Sign up on your own, and we'll begin your sessions at the group rate, continuing with one-on-one classes until we find suitable classmates to join you. This means you start benefiting from the group rate immediately!

For more details and to take advantage of this limited-time offer, please visit our website (registration takes just 2 minutes!).

For quick registration, just fill out this form and we will contact you as soon as possible.

If you want to know more about me, you can check out my resume or my life story: 10 years of competitive programming!

Happy coding!

Full text and comments »

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

By Arpa, history, 11 months ago, In English

Hello Codeforces Community,

I am AmirReza PourAkhavan,

  • Over 8 years of teaching experience, including teaching at the Iran Team Selection Camp for IOI.
  • Contest coordinator at LeetCode and formerly, Codeforces.
  • ICPC World Finalist (twice) and took a high-honored place, 24.
  • Solved over 5000 problems on various platforms.

Along with my dedicated team, I am thrilled to introduce our new project focused on developing the next generation of competitive programmers. Having competed in and coached teams for the Iranian and International Olympiads in Informatics, we have experienced firsthand the significant impact of competitive programming. It is with great enthusiasm that we are launching an affordable, high-quality training program to prepare ambitious individuals for the challenges and opportunities of IOI and other competitive programming contests, like ICPC.



For more information about the academy and to view my resume as well as those of other instructors, please visit our website.

Why choose us?

We explained some reasons on our website. But here is the main reason: we have designed an organized method for your training and development.

Unlike the other programs, for every student who enters Algoritmi Academy, there are three roles involved to help them grow. The first role is the instructor who teaches you the topics and solves the problem in the class meetings. However, there is a coach who has a long-term view of your path and always monitors the path you are on. If your progress is slow, they will talk to you and give you the necessary hints. Last but not least the last role is the leader who supervises the good performance and quality of the instructor and coach and is in constant contact with you so that if you have a problem with the current instructor or coach, they will immediately appoint another person for you so that you can improve in the best way.

FAQ

What is the pricing?
What programs do you offer?
How should I register?
Is there any financial aid?
Do you have any public benefit activities?

We wish you the best and are looking forward to seeing you.

UPD. We introduced group classes.

Full text and comments »

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

By Arpa, history, 13 months ago, In English

Hey, Codeforces!

I’m AmirReza PourAkhavan, the former Codeforces Contest Coordinator. I let the story become complete and I’m sharing it now.

The story is about a 16-year competitive programmer, who left his family and migrated to another city alone to follow competitive programming. After seven years, he advanced to the International Collegiate Programming Contest World Finals, twice.

Read the previous parts: 1, 2, 3.

Read the Persian version here.

What happened previously

I was a lone programmer, in a small city, trying to learn CP and prepare for the Iran National Olympiad. It was not as successful as I expected. I tried to change my school and I immigrated to Tehran, alone. I entered AE high school to learn from its inspiring teachers. I grew a lot there, I was about to win a gold medal.

Second Stage

Stage Two takes place over two days. The first day is a multiple-choice exam and the second day is a descriptive exam. The multiple-choice exam had 25 questions. On the first day, I managed to solve 17 out of 25 questions. I thought that probably I had very few mistakes.

The second day of the exam started with a familiar question. Right after seeing the question, I felt it could be transformed into a question that was discussed last week in the graph class. I started to attempt the question that was discussed in the graph class. A lot of time passed; more than three hours. Eventually, the space provided to write the answer for the first question was filled up, and I finally gave up on solving this question.

I moved on to the second question. The second question was solved in twenty minutes. There were about forty minutes left in the exam, and with the anxiety I had, I couldn't solve any other questions.

When I came out of the hall, I was confused and stunned. I was knocked out when I realized that my solution to the first question was fundamentally wrong. I took the metro home. When I arrived, the answer key for the multiple-choice questions was published. I started to calculate my result. I counted my mistakes... one... two... three... up to six. I opened the calculator. I calculated my percentage. It turned out to be 38 percent.

I fell from the chair to the ground. Tears quickly filled the ring around my eyes and spilled out of my sockets. Behind the sparkle of my tears, it seemed as if the house's ceiling was undulating. For a moment, all the codes I had written flashed before my eyes. In a moment, heavy-lights, centroids, all data structures, algorithms, and all the Codeforces problems flashed before my eyes. All the 1,200 problems I had solved on Codeforces. Perhaps no moment before or after that did I feel so broken this much. I have never been so upset. Even recalling this memory is not easy for me.

Nine months away from family, difficult commuting conditions, the pressure from other students and teachers towards me, and sleepless nights, all went up in smoke. I couldn't believe it. I started to argue with a classmate about my mistakes, but unfortunately, the answers were correct, and that 38 percent became my final score.



One of the images sent during the argument

I was not in a normal situation. That afternoon, I went for a walk with my family. I didn't know what would happen. I vomited everything I had eaten during those two or three days due to the psychological pressure. The memories I have from that afternoon include nonsense moments, hollow laughter, a head on the verge of bursting, a weak body, and a wounded soul.

When I woke up in the morning, my whole body was covered in pimples, even the scalp. Those few days passed with me worrying about what my score would be and how much the cutoff — the minimum score required to pass — would be, accompanied by sighs and regrets.

We returned to school. Mr. Asadi came to review our performance in the second stage. He calculated my score and estimated my chance of passing at 15%. When I came out of the counseling room, I was dazed and confused. Not that I wasn't prepared for this, no, but to hear within a few days from someone that I will win gold and now hear that I will not pass the second stage was a heavy blow; it hit me on the head. It hit me, and a few minutes later, I broke down crying in the school's congregational prayer line. It was the first time I had cried during prayer.

I felt like no one was acknowledging me. I remembered when I had come to take the entrance exam, the school manager told others, "So this year, we will have a gold medal from Yazd!". But after what happened, it seemed I had been forgotten. Now, looking back, it may not have been so, and my heightened sensitivity could have been the reason for this feeling.

On the other hand, others — not my schoolmates — approached me. These people played a significant role in helping me digest what had happened. In fact, they had a profound impact on my personal growth.

From that day on, I started wearing black clothes. Even the next year, on the anniversary of phase two, I dressed in black and dedicated the day to crying and mourning.

I wanted to fail myself in the school exams so I could participate in the Olympiad next year. But when I inquired, I found out they had made a rule that this couldn't be done.

The final school exams started. I didn't care about the exams and practiced coding instead. As a result, my average score was just over 15.

Return to Yazd

After the intense crying subsided, disappointment gave way to a feeling of vengeance. In the short time (about forty days) between the second stage of the Olympiad and the announcement of the results, I coded day and night. The number of my solved problems on Codeforces went from 1200 to 1500. Mehrdad Saberi, who won a silver medal that year and a gold medal the next, said, "Arpa is coding more seriously now than all of us," meaning that someone who knows he might not get accepted is taking it more seriously than those of us who know we will be accepted.

We gave back the house we had rented since, had I been accepted, I would have had a dormitory for the summer camp. Summer camp is part of INOI in which students have some classes and exams and finally, the medals will be determined. I returned to Yazd, to home. Not just me, but our entire house was engulfed in sorrow. Those days were spent in tears, sorrow, and both live and virtual contests. Alongside these sorrows, I grew personally through my acquaintance with these new people.

On Saturday, July 2, 2016, at night, the results were announced. I received these messages from one of the guys:

[03.07.16 03:03]
Hello, the best thing I can say to you is that I'm really happy you didn't get accepted.
[03.07.16 03:04]
Of course, since you're dumb :joy:, I'll clarify the sentence for you.
[03.07.16 03:05]
I mean, you've become so strong that if you had come to the summer camp, you would get a gold medal, and you took the
bread out of our mouth. :))

I wasn't in the mood for anything. I filed an objection, which was naturally rejected. And that was it. My student Olympiad dossier was closed. To this day, I sometimes dream that I am sitting for the second stage of the Olympiad. Sometimes I dream that another opportunity has arisen for me to participate in the Olympiad.

Next day afternoon, a channel posted the following:

Hello and congratulations to the kids who were accepted or not!
After all, it's destiny!
Someone said that everyone's chance is the same! But I don't believe in it!!! I don't believe in luck at all! I remember when Master Shifu told the Kung Fu Panda that nothing happens by accident (XD)
But I do believe in another correct thing that has filled my left side! And above all, I'm eager to try again, and that is God loves me! That's enough for a person to steer all life events towards the main goal!
Perhaps the smallest difference between these two beliefs is that I haven't lost anything, but he has! And I don't want to go back, but he wants to! And I'm not upset!
Now that we're in the 10th grade! There's an 11th-grade one among us who has put in a lot of effort for us! Well! Maybe this year he could have been one of the gold medalists! But God liked it this way for testing! Yeah! It seems that he has worked hard enough! And well, nothing has happened! Arpa, I hope you get a good rank in the university entrance exam, maybe first place!
Therefore, there's no reason to be upset if you weren't accepted as long as you tried!
"With water on determination, you can turn soil into gold
I was wrong to spend my life seeking alchemy"
Goodbye, our hero :D

Around that time, the idea of holding a programming competition came to mind. I can't exactly remember whether the idea was mine or Mehrdad Saberi's, but eventually, we decided to hold a competition. Gradually, we began collecting problems.

A few days later, I registered at Kanun (Ghalamchi). Kanun is the most famous organization for Iranian students to compete in normal school subjects and prepare for the National University Exam (konkour). Little by little, I started studying school subjects again. I couldn't quite bring myself to enjoy studying. But the subjects weren't that bad. For example, I remember I was studying optics in physics, which wasn't a bad topic.

At the same time, I started teaching in Yazd. Ali Tavassoli (AliTavassoly) had finished ninth grade at the time and was two years younger than me. He had emailed me a year earlier, asking me to show him the way. During that year (the summer of 2015 to the summer of 2016), we didn't have much contact, mostly just a few emails. But from the summer of 2016, our relationship became closer. Ali had learned the basics of programming and combinatorics. Throughout that summer, we had classes every Friday afternoon. Thus, Ali became my first student, even in the twelfth grade, the year of my university entrance exam! Our classes were about programming, and I taught him basic algorithms.



Left: Me and Ali Tavassoly, Spring 2022, right: Ali Tavassoly, Summer 2018

I took my first Kanun exam. The result was worthy! I took place 1100 (country-wise). I was happy. But one thing still remained a constant in the story: crying. I was still mourning the lost gold medal morning and night.

Since going to the Atomic Energy High School, my former school — Shahid Sodoughi — could not enroll me for twelfth grade. As a result, I had to find another school: Imam Hossein High School.

In September, I returned to Tehran to improve my school grades. I stayed at a friend's place. There was a significant gap between exams, so I had the opportunity to do other things. That year, Mojtaba Fayazbakhsh was responsible for the programming class of the summer camp. He agreed to let me attend his class. I didn’t do anything special, just helped out the kids a bit.

Thus, I entered the dormitory for the summer camp. I was with the kids. Sometimes we would even bet on virtual contests! In short, I did everything except improve my school grades! In fact, my scores even dropped in two subjects compared to before.



Me and dormitory kids

After those twenty days, I returned to Yazd again.

Twelfth Grade

The first exam of the twelfth grade was good. I ranked first in the school. However, this was not very important because the school was not a good one. For me, who had studied at Atomic Energy, it felt like a fall from grace. I could hardly relate to anyone at the school. Not the kids, not the teachers, not the officials. We were from two different worlds.

The kids didn't seem interested in connecting with me either. They saw me as a proud creature who separated himself from the group. In school, there was only one person with whom I could make a connection. Despite our profound differences in foundational thinking, it was still better than absolute loneliness.

Naturally, I was doing well in terms of studying compared to them, so I had a good relationship with the teachers.

Early in the academic year, Mehrdad and I got serious about organizing the contest. We planned to hold it on Codeforces. We sent our ideas to the coordinator at the time (Gleb). About a month later, on November 22, our competition was handed over to Nikolay Kalinin (KAN), and we continued the journey with him. Some details are described here.

While I was busy preparing the contest, I received advice from my family and especially the school. It got to the point where the school principal personally advised me to study for my lessons instead of focusing on such activities. But the truth was that the profound impact that organizing this contest had on my future was incomparable to the time lost for university entrance exam preparation.

During the preparation, a large number of problems were discarded, and others were selected as replacements. The final problem set took about a month to prepare. During this short period, I studied less, and my mind was occupied with the contest.

Our contest was not an ordinary one. We had drawn photos for all the problems. The problems had reasonable and interesting stories and were encompassed by an overall theme. Altogether, we took it very seriously and we tried hard.



The drawing for problem Div. 2 B of our contest

On the day of the competition, an unprecedented and crazy incident occurred on Codeforces. Due to this hardware incident, MikeMirzayanov decided to postpone the competition by five days. The contest’s blog post was hit with an endless stream of downvotes. I wondered how this could happen! Such an incident was unprecedented in Codeforces history, and it happened on the day of our contest. I saw this as a misfortune and added it to the bad luck of stage two.

Days passed, and the contest day arrived.

To be continued...

Full text and comments »

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

By Arpa, history, 17 months ago, In English

Hello everyone!

I'm just back from Syria. I was holding a camp for the Syrian team going to IOI 2023 for a week there.

First, let me use the opportunity to thank the hospitable people who hosted this camp. The camp was hosted by the Distinction and Creativity Agency (DCA). They tried out of their capacity for hosting the event as best as possible. Although Syria is not a rich and developed country, they pay attention to the Olympiad and their talents. They welcomed me in the best way and planned for some excursions and more.

The members of the Syrian team are Wael_Zaiback, aminsh, BERNARD, NeroZein. Almost all of them were super intelligent but without much knowledge. This is normal for a country without an Olympiad system and structure.



Because of that, I tried to cover as many topics as possible in the camp. To name some, I can mention geometry, tree data structures, and sqrt decomposition.

I hope the best for the Syrian team in IOI and the rest of their lives!

Full text and comments »

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

By Arpa, history, 21 month(s) ago, In English

Hey Codeforces!

I’m AmirReza PourAkhavan, the former Codeforces Contest Coordinator. I let the story become complete and I’m sharing it now.

The story is about a 16-year competitive programmer, who left his family and migrated to another city alone to follow competitive programming. After seven years, he advanced to the International Collegiate Programming Contest World Finals, twice.

Read the previous post here.

Read the Persian version here.

What happened previously

I was a lone programmer, in a small city, trying to learn CP and prepare for the Iran national olympiad. It was not as successful as I expected. I tried to change my school and I migrated to Tehran, alone. I entered AE high school to learn from its inspiring teachers.

11th grade

First day of school. I got to know my classmates: Yara Kamkar (yarak) and Michael Nematollahi (Deemo). As I mentioned before, AE is one of the few schools in Iran that have olympiads department. The olympiads department has its own manager and weekly program. Our weekly program consists of two free days, two days of normal lessons (Math, Physics, …), and three days of classes especially for the olympiad. For example, for the Informatics olympiad, we had combinatorics, graphs, algorithms, and coding classes.

Here is a suitable place to mention my teachers at AE high school:

  • Mojtaba FayazBakhsh (moji): INOI (Iran National Olympiad of Informatics) gold #1 and IOI silver. He was and currently is my inspirational life mentor.
  • Mahdi Shokri (M.Mahdi): INOI gold #1 and APIO gold. ICPC bronze medalist.
  • Amin Bahjati (Lost): INOI gold, INOM (math olympiad) gold, IMO silver #1.
  • Ali Bahjati (LiTi): INOI gold (two times), IOI gold (two times).
  • Abolfazl Asadi: INOI silver. Somehow the godfather of theory in INOI.
  • AmirMohammad Dehghan (PrinceOfPersia): INOI gold #2 and IOI silver.
  • Ali Haghani (Haghani): INOI gold #1 and IOI gold #6.
  • Seyed Ali Tabatabaee: INOI gold #2.
  • Arash BeikMohammadi.

By gold #x I mean the x-th place between gold medalists. They were great teachers. Maybe the best collection gathered for any competitive programming class in history. On the first day of our coding class, I managed to solve a nice geometry problem, while no one else managed. Great start! But things were not like that.

Where I lived



Fallah neighborhood

I was living in a small house. With a kitchen but no room. It was more than enough for me as a single student. The house was located in the Fallah neighborhood. With respect to cultured, warm-hearted, and likable people living there, Fallah is known for street fighting, addiction, and extortion.

For me, as a sixteen-year-old boy, living in this neighborhood was somewhat difficult. While living in that neighborhood, I witnessed some scary things. These may be normal for the people of the world. But for me, who had lived in Yazd — one of the safest cities in Iran — these were very unusual and scary. To better understand the environment in which I grew up, I can say that I have never heard of extortion in Yazd.

During my stay in that neighborhood, I once witnessed a street fight. Two groups of several people attacked each other and one stabbed the other and both groups ran away. Another day, while I was waiting for the bus, a passing drug addict fell right in the middle of the street. People came to help and brought him to the side of the street. Another time, I arrived in Tehran by train from Yazd in the very early morning. I took the subway to the station near home. There was about an hour left until sunset. Someone followed me from the subway to my house. That 15 minute was the scariest 15 minutes of my life.

To get to school, I used to leave home around 6:20 in the morning. I would take a bus to a station and then take another bus. Then a twenty-minute walk takes me to school. I usually reached the school around 8 o'clock. I always had questions in my mind that I solved on the bus. Usually programming problems and sometimes a theory. Sometimes I fall asleep while thinking about the problem.

At school

It wasn't long before I realized that I knew even less than 10th-grade students. For example, I didn't know about LCA and they did. After entering the school, I experienced a sharp drop in my rating so I was below 1600 for a long time. My performance was bad in classes and I felt a serious difference from my classmates. Sometimes Yara (one of my classmates) helped me learn a subject.

The classroom atmosphere was cold. On the one hand, the number of classmates was small, on the other hand, a cold war started between Michael and me. I hardly remember some details. The whole story was that, in my opinion, Michael was very arrogant, and this arrogance hurts me. Yes, I was much weaker, but this couldn’t be used as a reason for him to ignore me. I miss this amount of ignoring. This cold war lasted until the end of school, and even after that, it didn't get much better. I was sometimes teased not only by my two classmates but also by the teachers for being weaker.

From the day I entered the new school, I studied the Olympiad seriously. According to the official statistics of our Olympiad manager, I broke the high school record for the most hours of study per day, week, month, and year. One day I was coding for seventeen hours and forty minutes from midnight to the wee hours of the next day (something like twenty-six hours). I remember that there was doubt among the counselors of the school if this number of study hours is real. The manager of the Olympiad replied: "Yes; He [Amirreza Purakhan] is like a rocket." It's a shame that I don't use this opportunity and ignore the efforts that the Olympiad manager — dear Mr. Ali Shahsavari — made for me. It is a source of happiness that I am still in contact with him.



Ali Shahsavari

Many nights I would code until around 1-2 AM and wake up again at six to go to school. The night before holidays, I sometimes slept early. I would wake up around four in the morning and start coding. One of my interests was to see the friends' status page on Codeforce. I used to enjoy when I would wake up early and get some accepts and then see that the others had started working.

All these efforts, however; gave fewer results. My performance in classes was not good. I didn't do well in Codeforces contests either. Although, I did not do so badly on the school tests. The graph class was very bad. I could hardly solve a question in class. In classes, we used to solve Div.1 E questions, but sometimes I couldn't even solve Div.2 B in contests.

About three months of the school year had passed. Abolfazl Asadi — the head of the computer department — held a meeting with each of us separately to discuss our situation. Mr. Asadi's words in that meeting were realistic. To some extent, it was understood from his words that he is disappointed with me. After that conversation, there was no particular change in me; Neither positive nor negative.



Abolfazl Asadi

First semester exams came. During this period, Olympiad classes were interrupted for about a month. I didn't pay attention to the semester exams and focused on coding. Sometimes I would sleep at 9 o'clock at night and wake up at 3 o'clock in the morning and start coding. I coded day and night. In just one period of four months, I accepted ~800 problems in Codeforces. I used to participate in many virtual contests and after that, I would solve the questions that I was not able to solve in the contest. Some days I participated in five virtual contests.

From the beginning of the second semester, I felt a slope in the programming classes. But in Codeforces, the situation didn’t change.

It finally led to a result

On February 4, 2016, I ruined another contest and became a Specialist again. Three days later, in round #342, I ranked 18 on Div.2 and got +229. I also broke my rating record.

Wow! Coder Arpa competed in Codeforces Round #342 (Div. 2) and gained +229 rating points taking place 18

Less than twenty days later, I reached Div.1. I passed 1900 and wore purple. Two days later, I took part in a contest again and gained a positive rating again.

The morning after that contest, when I went to school, the schoolmates' behavior changed. I was looking like a new person. I was floating on air. Finally, my efforts were paying off. My growing trend continued in the classes. In the graph class, however, I still did not have a good situation. The graph teacher suggested that I should show up in the 10th-grade class.

The beginning of the second semester was accompanied by several changes in the weekly schedule. Seyyed Ali Tabatabai gave his place to Mojtaba Fayazbakhsh. The first day I saw him, I did not have a positive opinion. Earlier, when I was in Yazd, he had a class with us for a few days in Yazd Nowruz camp. Nowruz is the Persian new year holiday. These classes were not interesting to me. Especially that after he described the solution to a problem, he asked me to come to the whiteboard and explain and I couldn't! He also emphasized that he has studied a lot on the way to his success. My impression was that he is a person of ordinary talent who got succeeded by studying too much. This was not desirable in my opinion.



Mojtaba FayazBakhsh

His classes were different from other teachers. He used to talk about unordinary topics in his classes: limits, probabilities, physics, and even the problem of determinism and free will! Things that maybe had nothing to do with the Olympiad. After each class, I and Mr. Fayazbakhsh both used to go to the subway from school. It was about half an hour. We had different conversations on the route. Sometimes we didn't finish talking on the route and we continued in the subway for a while. I was never that close to a teacher. It didn't take more than a few weeks for me to realize that the opinion I had of him was wrong. I really liked his character. In that teenage mood, I felt him as a mentor, somehow. I remember he asked me for feedback once on the route. I respectfully suggested that there is a lot of irrelevant discussion in the class and I prefer the class to focus on the Olympiad. Of course, I also gave positive feedback, but I don't remember.

The same growing trend continued until Nowruz. I stabilized my rating. I was completely confident in the Nowruz camp. All in all, I was the best in the class during the few weeks of classes held after Nowruz until the second stage — late April. That is, I solved more questions than others. Five days before the second stage, Mr. Asadi had important talks with me. Part of what he said was that if you progress with the same slope from the time between stage two and stage three, I strongly predict you will win a gold medal. I saw gold before my eyes. I was tasting success.

During these seven months that I lived alone, I traveled to Yazd two or three times. Usually, my mother or father came to Tehran every few weeks. They would prepare some basic ingredients for food and stay for a day or two and return. Mornings, usually minutes before leaving the house, I would spread cocoa on bread and make breakfast. The school served lunch. The remaining: launch for two days and at dinners. I usually cook rice. Along with rice, I sometimes heated frozen stew. Sometimes I fried chicken. Sometimes the landlord brings me food. Many nights, before going to bed, I remember that I haven't eaten dinner. There were different options on the table! Some nights I ate rice and tomato paste! That was interesting. Some mornings, I just remembered that I don’t have bread in the house. The natural result was to starve.

While cooking, I would solve questions and even participate in virtual contests. Result? Burning food. The rice I cooked usually came out dry. Because every time I made rice, I poured so much rice into the pot that it overflowed while cooking. To summarize, these were all peripherals and the main goal was the big goal I had aimed for. I was born to win gold and now I just needed to wait a little longer to achieve this goal.

A few days before the second stage, my family came to Tehran to spend the remaining days together. I should rest and prepare for the exam. In these few days, after months, I ate good food! I ate good food at lunch and dinner and enjoyed being with my family. Of course, despite the teachers' advice, I didn't stop coding even the day before the exam.

To be continued...

Update: Read the next part here.

Full text and comments »

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

By Arpa, history, 2 years ago, In English

Hey Codeforces!

I’m AmirReza PourAkhavan, Codeforces Contest Coordinator. I let the story become complete and I’m sharing it now.

The story is about a 16-year competitive programmer, who left his family and migrated to another city alone to follow competitive programming. After seven years, he advanced to the International Collegiate Programming Contest World Finals, twice.

Read the previous post here.

10th grade

Trying alone

In my tenth grade, the situation got worse. Before that, at least, I had some colleagues and at least a class per two weeks. But in the new grade, these brights disappeared too. Still, I was trying to do it alone. I remember when I learned the Dijkstra shortest-path algorithm and implemented it for the first time, how happy I was.

Suddenly, my rating growth started. As you can see, my rating in Oct ‘14 was 1057 (minimum rating) and In Feb ‘15 I achieved 1761. Those years, >= 1700 was Candidate Master and Div. 1. The special thing is, my rate growth was not because of my endeavors in that tight time segment. In fact, a year of trying and losing ratings resulted in a big jump: a 700 jump in ratings. I got so much motivation. I was doing well in contests.

In the first stage of the national olympiad, I achieved a weak result. The good point was, it has no effect on the outcome of future stages. This didn’t affect my motivation.

I was not participating in ordinary classes in school and raising the bet every day. I went to school from 7 AM till 10 PM, not participating in the classes but instead, I went to the site (the room in the school where computers are located). I went there to study, but there was a problem. Sometimes, we played games, and sometimes a lot. It had two reasons: colleagues and myself. I sometimes felt low motivation. I think the main reason was the lack of a mentor. When you don’t have someone that monitors you and tracks what you are doing, you lose motivation, and play games instead of studying, I think. Playing games didn’t only waste my time, but also made me less motivated and made my will weak. This is a black cycle, you waste your time, you lose motivation, you will become weaker, and you play more. I encountered this black cycle. I remember that sometimes I played for 5 hours. The game we played was Counter Strike 1.6.

I started studying for the next stage. I was taking exams for the previous years and I was good at them. Sometimes, I finished some of them with perfect scores. The second stage of INOI is about combinatorics and graphs. Sometimes it has algorithms too but everything is on paper. Because of this, in February I switched to studying theoretical topics (like counting) instead of coding.

One of the problems in the second stage of INOI, that year

The second stage was held in May (2015). I participated in the exam and I felt it was great. When we were exiting the exam hall, during a discussion, I realized that I missed a sentence in the first problem and missed 15 points. It was not a problem, the overall score was 300 and I thought my score would be still 149 and 15 points were not important. Anyway, the exam was finished. I felt that I’ll pass this stage as, in the previous years, the score for getting passed was something like 130 out of 300.

Again, I switched to coding. The playing issue was getting worse. I was trying to stop gaming and instead coding, but I was not successful. As you can see, I was losing ratings slowly at that time.

Results published

Time passed, and publishing the results of the second stage was near. It took almost two months from the exam to the results being published. In the old times, channels on messengers were not popular. So you need to check the Iran National Olympiad website manually to know if the results are published or not. Students were refreshing the website each moment you know. I implemented a PHP code and ran an RSS server. RSS is somehow deprecated nowadays. My code fetched the website every minute and pushed a notification to all of the registered devices to the RSS server on changes. It was fun.

On 8th July 2015, I lost my grandmother. It was sudden. She was in the hospital for just 10 days and we lost her. Because I expected that I would be at the funeral for several days, I asked my friend, Alireza Tofighi (ATofighi) to call me when the results were published. On the 9th, at about 3 pm, AliReza called me. When he said “hello”, I got everything. He was trying to somehow help me in that sad situation. My name was not on the list of passed students. I said: “Please take a look at all the lists again and again”. But the answer was no, again. However, Alireza passed the exam.

I found an empty time slot, lied next to my grandmother's grave when no one was there and cried for a long time. As a fifteen years old boy it was my first defeat in my life, and it was so hard. I was unable to digest it. I thought of the time I waste playing games. I was remembering a quote: “The tears we shed after every failure are actually the sweat we didn't shed for success”.

Soon I got the details about my result. I scored 113 out of 300 on the exam, so much less than I expected. It was because I didn’t know “how to write”. I solved the problems, but my writing was not proper and I lost so many points in many problems. The passing score was 126 that year. I was sorrowful that if I read that sentence I would get accepted.

Change it!

Suddenly, I decided to change the situation. It was a blind and unreachable idea at first. I thought that if I go to a better school, I can perform better next year. There are a few schools in Iran that have an olympiad department alongside normal students. Almost all of the medalists in every olympiad (informatics, math, physics, …) are from one of these schools. The two most known schools are AE high school and Allame Helli. In the schools with the olympiad department, the department holds olympiad-specific classes regularly. For example, in the informatics department, students have classes on algorithms, coding, combinatorics, and graphs. So their main focus is on their special classes, while they have minimal ordinary classes too.

I started to talk with Mehrdad Saberi Batman who did the same. He was studying in a non-popular school and switched to Allame Helli at that time. I talked to my family about this. At first, they become confused. It almost never happened in my town that somebody changes his high school. It was a very rare and strange thing. I started to explain why I need this. I’m happy that I had a family that always supported me. They started to think about it. My father clarified that he and my mother are working in our city and it’s impossible for them to migrate to Tehran (the capital, where good schools are located). He said: “I can support you and rent a house, but it’s impossible for us to migrate”.



Allame Helli high school

The process started. I asked for an official migration request from our school. I wanted to go to Allame Helli. To change my school, I needed to do a special routine in NODET (National Organization of Development of Exceptional Talents). NODET is an organization in Iran that takes care of talents before university. NODET has schools in some cities, depending on their population. There are ~600 NODET schools in Iran. A student can migrate from a NODET school to another in special cases. I was studying at NODET high school in Yazd and Allame Helli is one of the NODET schools in Tehran. Soon, my family and I went to Tehran to follow the migration process. The Allame Helli high school welcomed me. But the school's approval is not enough for migration, I needed NODET approval too.

NODET has ten high schools in Tehran. Allame Helli is one of them. Other schools have a big gap with Allame Helli. So I needed approval not only for migration to Tehran but also for getting into Allame Helli. I brightly remember when we (my parents and I) went to the NODET office to get approval. There was a non-friendly man. He was responsible for processing my case. I asked him if it’s possible to get into Allame Helli and he said: “See if you are allowed to enter Tehran or not!”. He meant we may even not accept you in any school in Tehran (what about Allame Helli). He humiliated me as a student studying in a small city.

Not only I but also my parents were so upset after we left his room. One of the staff there saw my father in that mental state and asked about the story. After my father described the story, he suggested we call Mr. Shahsavari. Shahsavari was (and currently is) the manager of the olympiad department of AE high school (which is a competitor school with Allame Helli). AE is not a school under NODET, it's a private high school. Soon, we contacted him. I told him that we can’t afford the huge amount of school costs. The cost of AE was three times the cost of Allame Helli and the cost of Allame Helli was three times the cost of my previous school. He kindly replied that we’ll help you.

Last days in hometown

We went back to Yazd. The situation was almost clear: I was going to AE. A few days later, a strange thing happened: Someone from Allame Helli called my father. He welcomed and respectfully said that we resolved all things related to NODET and we’re ready for registration of your son. I don’t want to go deeper in this part and judge what happened. Anyway, I talked to several people about this and finally concluded to go to AE.

Still, the game problem was with me. I lost my rating and was under my maximum by 100 ratings. On the 25th of September 2015, in the afternoon, I played “Teeworlds” for the last time and removed it from my laptop. September 26th was my first day in my new school. I told myself that I’ll never come back to play and I’ll focus on studying as much as possible. I was changing…

Read the next part here.

Full text and comments »

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

By Arpa, history, 2 years ago, In English

Hello Codeforces, especially girls!

The second Europian Girls Olympiad of Informatics just finished. The competition was hosted by Turkey in Antalya. It was the first year this competition was held onsite. EGOI is somehow a girls' version of IOI because countries like Singapore and Peru participate in it too. 45 countries participated in EGOI 2022, while the number of countries participating in IOI is ~90.

I was part of the scientific committee of the competition. I found a great team around me.



From left to right: Fatma Basak Aydemir (Turkey, SC), Nils (Sweden, Problem Setter), Hakan (Turkey, SC), Cheng (China, Problem Setter), I (Iran, SC), Stanislaw (Poland, Problem Setter), Vlad (Romania, SC), Petr (Switzerland, Problem Setter). Tolga Can didn't attend on-site but he was the head scientific committee. Also, Fatih Damirci (head of the Turkey informatics olympiad) was the organizer of the event. He helped us (the Scientific Committee) in many ways.

The Turkish host did everything so that it couldn’t be possible to improve it. I’m wondering if some other country could bet them in the future. We stayed for a week in a 5-star hotel near the beach, two excursion days, and a boat trip. Here you can see what happened in EGOI 2022.

This year, we had more countries and also, stronger participants. Then we prepared a significant harder contest. To give an approximation, the problems were ranging between Div.2 D and Div.2 F.

The results are here. Duru from Turkey took the official first place and made the host very happy.

You can find solutions here (it’s possible that the subtasks don’t match). I'll add solutions for other problems soon. The problems will be soon online for practice.

Thanks to arsijo the problems can be virtually upsolved here:

European Girls Olympiad in Informatics 2022. Day 1

European Girls Olympiad in Informatics 2022. Day 2

Full text and comments »

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

By Arpa, history, 2 years ago, In English

Hey Codeforces!

I’m AmirReza PourAkhavan, Codeforces Contest Coordinator. I let the story become complete and I’m sharing it now.

The story is about a 16-year competitive programmer, who left his family and migrated to another city alone to follow competitive programming. After seven years, he advanced to the International Collegiate Programming Contest World Finals, twice.

Why I’m writing this

Six years ago someone asked me here to write my story. I think it can help you to never give up.

A brief about me

I've been doing competitive programming for ten years. I advanced to ICPC (International Collegiate Programming Contests) World Finals twice, in 2019 at Porto and 2020 at Moscow. At ICPC World Finals 2020, our team took high-honored place twenty-four, which is equal to the top 0.03% of 200k students participating in ICPC.



I am presenting in the ICPC World finals Porto, 2019: CP-connect, A problem recommender.


I am presenting in the ICPC World finals, Moscow 2020: Let the students grow (on successful teaching).

I was a tester, problem setter, editorialist, and contest coordinator at Codeforces, Topcoder, CodeChef, and HackerEarth, for five years. Also, I am (was) a judge at Africa and Arab Collegiate Programming Contest (super regional competition for ~70 countries) 2021, 2022, and European Girls Olympiad of Informatics (girls version of IOI) 2022.

I’ve solved ~3.7k problems on Codeforces, and ~5k problems overall. I have been teaching Algorithms, Data Structures, and competitive programming for ICPC and IOI for six years. I’m also a software engineer and algorithm designer at a company.

How I started the competitive programming

I was 13 years old when I learned QBasic – a simple programming language. In 7th and 8th grade, I learned QBasic and VB at school. We had a competition in our middle school called B.M.M. (Best Programmer in School) (Yes it should be BPS, but it’s Persian). I took second place and it was a sad thing for me that I lost the competition to my friend and my competitor ATofighi.

In the 8th grade, we made a team and competed in the HelliNet Programming Contest which is the most known high-schooler competition in Iran. We took almost the last place. All participants received a simple big cup with the HelliNet logo. It was nice for me.

9th grade

In the early 9th grade (Sep 2013), I became familiar with real competitive programming. I went to the olympiad. By olympiad, I mean the Iran National Olympiad of Informatics (INOI) specifically; and generally, the International Olympiad of Informatics.

I used to live in Yazd. Yazd is a city with ~500k population in Iran. As you may know, Tehran is the capital of Iran. Yazd is 700 km far from Tehran. Finding an olympiad teacher in Yazd was (and currently is) almost impossible. On the other hand, there were (and currently are) many professional olympiad teachers in Tehran. I was aware that I needed to pass the path alone.

A teacher (Seyed Hamed Sadat Hosseini) taught me C++ in the summer before 9th grade. He was my first teacher. I still meet him sometimes and I thank him for all his effort to help me start the path. I started learning Combinatorics, Graphs, and at the same time, Algorithms, Data Structures, and coding. I felt that I love competitive programming and the olympiad.

We were several olympiad-lover students, trying without a guide. We were going nowhere. Solving random problems on Codeforces and gaining and losing ratings at random. We had a teacher or two who held limited classes for us. I participated in classes, but most of my growth was on my own.

I didn’t participate in many regular school classes. Instead, I studied for the olympiad. Let me describe how the olympiad works in Iran.

How INOI works

Students can participate in INOI two times: in the 10th grade and 11th grade. Each year, a season of INOI runs. Each season starts in about February and ends in September. It contains several stages. In the past 9th grade students could participate in the first two stages just to become familiar.

In the first stage, about 10k students participate and 1000 students pass. Then in the second stage, this number reduces to 80. These two stages are theoretical (combinatorics, graphs). Then we have a third stage, which is coding.

The forty students passing the third stage enter the summer camp. They review their knowledge and at last, they take several exams and they win medals. Gold medalists will be free to choose every major and every university to study in without participating in any exam and for free. Other students need to participate in an exam called Konkoor to get into university.

Silver and Bronze medallists have a huge bonus when participating in Konkoor. E.g. if a medalist took place 5000, it’s like that he took place 1000. Note that all of the expenses of students studying in top universities (top ~100k students) in Iran are covered by the government.

Let's get back to the story. Studying for the olympiad instead of Konkoor is a risk. Why? Because if someone fails in the olympiad, he’ll have just one year (12th grade) to get prepared for Konkoor, while others try for 3, or 4 years. I was taking a risk. In February 2014, I participated in the first stage of INOI and passed with a high grade. It was a good start. I was very happy. You can see that my rating was pupil at that time. Again, I and Alireza (ATofighi) participated in HelliNet. We took place ~15. I got my first T-shirt in that competition.

I experienced a high rating loss at the end of the 9th grade. At that time I didn’t know any algorithm/data structure. I knew combinatorics (counting, simple induction, ...) and was able to solve simple graph theory problems. I started 10th grade with a rating of 1057, Newbie.

To be continued...

UPD: Read the next part here.

Full text and comments »

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

By Arpa, history, 3 years ago, In English

Hello Codeforces!

I'm glad to write a tutorial post again after several years (you can find old tutorials in my blog posts). I'm here to present an implementation for an algorithm that calculates inclusion hierarchy among circles. The main article can be found here. The repository where the implementation can be found is here. If you want to play, it has a python GUI too.

The problem

Consider $$$n$$$ non-intersecting circles. Some circles can be inside of others. We need to make a tree of these $$$n$$$ circles such that if $$$i$$$-th circle is inside of $$$j$$$-th circle, the $$$i$$$-th vertex be in the subtree of $$$j$$$-th vertex. For example:

Examples

The black vertex is the whole surface itself.

Algorithm description summary

Move the sweep-line from left to right. At each $$$x$$$, the sweep-line intersects with some circles in some segments of $$$y$$$. These segments are non-intersecting but some of them could be inside of other ones. We need to dynamically keep the order of these segments in our set (e.g. std::set in C++) and when sweep-line sees a new circle, we can find the parent of this circle in the set using a binary search (lower_bound in C++).

Time complexity is $$$\mathcal{O}(n \log n)$$$. You can find the details in the main article or the implementation.

This was my Bachelor's project, you can see the full project here.

Full text and comments »

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

By Arpa, history, 3 years ago, In English

Hi!

CLIS (Competitive Learning Institute Symposium) is one of the programs at ICPC World Finals every year. As you know ICPC World Finals '20 is going to be held in ~2 weeks in Moscow. I had two proposals for the symposium that both accepted. Abstract of one of them goes as follow:

We're not good in our jobs?

Peter Norvig: "One thing that I can share that was surprising to me is: being a winner of one of these programming contests was actually a negative factor for performing well on the job.",
What does it mean? We're performing badly on our jobs? If so, why?
In this presentation, I'm going to take a survey of competitive programmers on their job.

  • As a teacher, how to make CP as close as possible to the job?
  • What happens in CP and what happens on the job, why they are different?
  • What're the main abilities that CP makes them grow and what are the abilities needed on the job?
  • Is the salary of competitive programmers more than others after several years?
  • Which technologies (e. g. Networking, AI, IoT) are more close to CP?
  • What are the most important negative factors of competitive programmers, in sight of their managers on their job?
I'll do several interviews with old competitive programmers who are doing their job good and ask for their experience for better presentation.

As here is the biggest competitive programming community, can you please share your experience with me? For example,

  • If you were a competitive programmer and you're now working in a company, which abilities you're using from CP?
  • If you're a human resource specialist, can you please answer this question: Is the salary of competitive programmers more than others after several years?
  • If you're a team lead and have someone in your team that is a competitive programmer, how do you evaluate him? Are you satisfied?

PS. If you're a WF attendee, I'll be very thankful if you attend my presentation.

Update. The presentation is over. You can download the slides and watch the presentation.

Full text and comments »

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

By Arpa, history, 3 years ago, In English

Hi.

I recommend everyone to participate in Iranian Combinatorics Olympiad.

Full text and comments »

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

By Arpa, history, 4 years ago, In English

Hi!

Check out my interview with Natalia.

Full text and comments »

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

By Arpa, history, 4 years ago, In English

Hello Codeforces!

Every month, there will be a problem with complete explanations and solutions for one of the month's problems. Here is the problem of February. Feel free to ask me questions and suggesting edits.

Please help me by proposing a problem for the next month. In the November contests, look for a challenging problem that you would like to have complete explanations of it.

Also, what do you think about video tutorials instead of text editorial?

Full text and comments »

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

By Arpa, history, 4 years ago, In English

Yes! I’m back with the problem of the month series, hosted by Topcoder.

Every month, there will be a problem with complete explanations and solutions for one of the problems of the month. Here is the problem of October. Feel free to ask me questions and suggesting edits.

Help me by proposing a problem for the next month. In the November contests, look for a challenging problem that you would like to have complete explanations of it.

Full text and comments »

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

By Arpa, history, 5 years ago, In English

Hello, Codeforces community!

I am very proud to announce SRM 787 is underway, authored by me. The contest will start today at 16:00 UTC.

It is my third experience in holding a contest at Topcoder. Holding contests on Topcoder is always memorable, having misof as contest coordinator and hmehta as a kind helper, it can't be nice more. Although struggling with Java and MPSQAS is not easy, being with a kind and professional team makes it sweet. So thank you Misof and Harshit! Also, Misof tested the contest.

Problem stories are all about my honorable mighty teacher, Abolfazl Asadi, who is currently doing great in teaching students and preparing them for INOI (Iran National Olympiad of Informatics). You will know him in problem statements as "Aqa Asadi". "Aqa" means "Sir" in Persian.

Abolfazl Asadi

I can't skip thanking my dear friend Javad javaD Karimi, who proposed the idea of Div. 1 Easy.

P. S. Please note that the coding phase will begin at 16:05 UTC but the registration will still close at 15:55 UTC.

Good luck to everyone!

Full text and comments »

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

By Arpa, history, 5 years ago, In English

I'm honored to introduce you to the article series, Arpa's problem of the month, hosted by Topcoder.

Every month, there will be a problem with complete explanations and solutions for one of the problems of the month. Here is the problem of April. Feel free to ask me questions and suggesting edits.

Help me by proposing a problem for the next month. In the May contests, look for a challenging problem that you would like to have complete explanations of it.

P. S. "Arpa's problem of April" is something rhythmic, isn't it?

Full text and comments »

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