Erfan.aa's blog

By Erfan.aa, history, 5 years ago, In English

Hello Codeforces,

I'm here to introduce Testsaz to you.

Testsaz is a fast, minimal test-case generator system for ICPC-style and IOI-style problems.

It can be helpful when you're preparing some problems for algorithmic contest and Algorithm Design and Data Structures courses.

Here you are: Testsaz GitHub repository

Any feedbacks and contributions are welcomed.

Good luck!

Full text and comments »

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

By Erfan.aa, 5 years ago, In English

Hello Codeforces!

Surprisingly, some rules of the Asia West Continent ICPC have been changed.

ACM-ICPC regions

I'm bringing them to you from the ACM-ICPC Asia director's blog: http://blog.sina.com.cn/cjhwang

After the typical regional contests, two new contests are going to be held in Tehran and Kolkata in January 2020.

Read more to figure out the details.

Full text and comments »

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

By Erfan.aa, history, 5 years ago, In English

Hello Codeforces!

Every year in October, DigitalOcean organizes an event named Hacktoberfest. Hacktoberfest is open to everyone. Whether you're a developer, student learning to code, event host, or the company of any size, you can help drive the growth of open source and make positive contributions to an ever-growing community. All backgrounds and skill levels are encouraged to complete the challenge.

To qualify for the official limited edition Hacktoberfest shirt, you must register and make four pull requests (PRs) between October 1-31 (in any time zone). PRs can be made to any public repo on GitHub, not only the ones with issues labeled Hacktoberfest. This year, the first 50000 participants who successfully complete the challenge will earn a T-shirt.

As a member of TheAlgorithms organization, I invite you to contribute to our repositories. As it is mentioned above, PRs can be made to any public repo on GitHub, so public repositories of TheAlgorithms organization can help you win this competition.

TheAlgorithms repositories are used to store all different available algorithms for educational purposes. You can see that:

https://github.com/TheAlgorithms/Python is for all algorithms implemented in Python programming language.

https://github.com/TheAlgorithms/Java is for all algorithms implemented in Java programming language.

https://github.com/TheAlgorithms/C-Plus-Plus is for all algorithms implemented in C++ programming language.

Members of the Codeforces community are experts in the design of algorithms. So they can easily add some new algorithms to these repositories or improve the previous ones to gain Hacktoberfest credits. Only 4 pull requests suffice for winning a shirt.

After creating each pull request, you can notify me through my GitHub account or my email address for reviewing/merging it.

Happy coding!

Good luck!

Full text and comments »

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

By Erfan.aa, 5 years ago, In English

A series of weekly design of algorithms and data structures classes is going to be held at University of Tehran for the Iranian students.

Instructors: Haghani (Ali Haghani), Erfan.aa (Erfan Alimohammadi), ShayanH (Shayan Hosseini), navidda (Navid Rahimi Danesh), Man (Parsa Abdollahi), M.Mahdi (Mohammad Mahdi Shokri)

More information and the registration link are available on University of Tehran ACM Student Chapter channel: https://t.me/ut_acm

Full text and comments »

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

By Erfan.aa, history, 5 years ago, In English

Greetings Codeforces Community!

You are invited to participate in the CodeChef September Lunchtime — a 3-hour contest with 5 problems to be solved. This is a chance for you to participate and improve your programming skills along with your CodeChef rating.

The problem statements of the contest will be accessible in English, Hindi, Bengali, Russian, Mandarin, and Vietnamese. I hope you will connect with your fellow programmers and enjoy solving the contest problems. Joining me on the problem setting panel are:

  • Setters: kingofnumbers (Hasan Jaddouh), Odin- (Jafar Badour), Mhammad1 (Mohammad Shahhoud), Atreus (Abolfazl Soltani), Erfan.aa (Erfan Alimohammadi)

  • Tester and Editorialist: Pepe.Chess (Hussain Kara Fallah)

  • Statement Verifier: Xellos (Jakub Safin)

  • Mandarin Translator: gediiiiiii (Gedi Zheng)

  • Vietnamese Translator: Team VNOI

  • Russian Translator: Mediocrity (Fedor Korobeinikov)

  • Bengali Translator: solaimanope (Mohammad Solaiman)

  • Hindi Translator: Akash Shrivastava

Contest Details:

  • Start Date & Time: 28th September 2019 (1930 hrs) to 28th September 2019 (2230 hrs). (Indian Standard Time — +5:30 GMT) — Check your timezone
  • Contest link: https://www.codechef.com/LTIME76
  • Registration: You just need to have a CodeChef handle to participate. For all those who are interested and do not have a CodeChef handle, are requested to register in order to participate.
  • Prizes: Top 10 Indian and top 10 Global school students from ranklist will receive certificates and CodeChef laddus, with which the winners can claim cool CodeChef goodies. Know more here: https://discuss.codechef.com/t/how-do-i-win-a-codechef-goodie/7344. (For those who have not yet got their previous winning, please send an email to [email protected])

Good Luck!

Hope to see you participating!

Happy Programming!

Full text and comments »

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

By Erfan.aa, history, 5 years ago, In English

Greetings Codeforces Community!

You are invited to CodeChef’s August Cook-Off. This is a 2.5-hour coding competition featuring 5 problems and it’s open to programmers across the globe. The contest problems will be available in English, Hindi, Bengali, Russian, Mandarin, and Vietnamese.

In addition, if you have some original and engaging problem ideas, and you’re interested in them being used in the CodeChef's contests, you can share them here. Looking forward to seeing your participation in yet another exciting monthly contest! Joining me on the problem setting panel are:

Contest Details:

  • Start Date & Time: 18th August 2019 (2130 hrs) to 19th August 2019 (0000 hrs). (Indian Standard Time — +5:30 GMT) — Check your timezone

  • Contest link: https://codechef.com/COOK109

  • Registration: You just need to have a CodeChef handle to participate. For all those, who are interested and do not have a CodeChef handle, are requested to register in order to participate.

  • Prizes: Top 10 performers in Global and top 10 performers in Indian category will get CodeChef laddus, with which the winners can claim cool CodeChef goodies. Know more here: https://discuss.codechef.com/t/how-do-i-win-a-codechef-goodie/7344 (For those who have not yet got their previous winning, please send an email to [email protected])

Good Luck!
Hope to see you participating!!
Happy Programming!!

Full text and comments »

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

By Erfan.aa, 6 years ago, In English

Greetings Codeforces community!

I am sure you have heard that CodeChef is celebrating 10 years of competitive programming!

I would like to invite you to compete in March Cook-Off, sponsored by ShareChat. The Cook-Off is 2.5 hours contest and offers 5 problems for you to try your hand at. And as CodeChef is celebrating its birthday, there are additional prizes up for grabs.

ShareChat- India’s fastest growing social network and sponsor of the contest is seeking talented programmers to join their team. Internships and full-time job opportunities are available for participants of the March Cook-Off. Visit the contest page for more details.

I hope you will join your fellow programmers and enjoy the contest problems. Joining me on the problem setting panel are:

  • Admin: kingofnumbers (Hasan Jaddouh)
  • Tester and Editorialist: Pepe.Chess (Hussain Kara Fallah)
  • Statement Verifier: Xellos (Jakub Safin)
  • Setters: Erfan.aa (Erfan Alimohammadi), AminAnvari (Amin Anvari), Haghani (Ali Haghani), aliams (Ali Mirjahani), mrm_196 (Mohammad Reza Mohseni), farnasirim (Mohammad Nasirifar)
  • Mandarin Translator: huzecong (Hu Zecong)
  • Vietnamese Translator: Team VNOI
  • Russian Translator: Mediocrity (Fedor Korobeinikov)
  • Bengali Translator: solaimanope (Mohammad Solaiman)
  • Hindi Translator: Akash Shrivastava

Contest Details:

  • Start Date & Time: 24th March 2019 (2130 hrs) to 25th March 2019 (0000 hrs). (Indian Standard Time — +5:30 GMT) — Check your timezone
  • Contest link: https://www.codechef.com/COOK104
  • Registration: You just need to have a CodeChef handle to participate. For all those, who are interested and do not have a CodeChef handle, are requested to register in order to participate.
  • Prizes: Top 10 performers in Global and Indian category will get CodeChef laddus, with which the winners can claim cool CodeChef goodies. As CodeChef is celebrating 10 years of cooking, there are additional laddus up for grabs. Know more about the additional prizes here: https://www.codechef.com/COOK104 and about the laddus here: https://www.codechef.com/laddu
    (For those who have not yet got their previous winning, please send an email to [email protected])

By the way, happy Nowruz!

Happy programming and have a great new year!

Good Luck!

Full text and comments »

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

By Erfan.aa, 6 years ago, In English

Hello!

As you know, each team can have a notebook for their reference in any ACM-ICPC official contest. Actually, this is a rule of regional and World Finals ACM-ICPC contests, that you can bring some papers with yourself. Usually, each team put some source codes of different algorithms in their cheatsheet.

Generating this cheatsheet would be a little hard, because you may want to put many source codes in a few pages. Also, you may want to add a table of contents to it. And the most important part is to have syntax highlighting for your codes.

I just wanted to introduce you a tool for this purpose. Its name is "codes2pdf" and it's here: https://github.com/Erfaniaa/codes2pdf

(Actually, it's forked from pin3da/notebook-generator and it has been improved.)

Just give your cpp, py, java, and tex files as an input to it; it will generate a PDF file for you. Sample PDF file

I hope it will be helpful to you, even in fields which are not related to ACM-ICPC.

Full text and comments »

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

By Erfan.aa, 10 years ago, In English

459A - Pashmak and Garden

Four vertices of a square with side length a (and sides parallel to coordinate axis) are in this form: (x0, y0), (x0 + a, y0), (x0, y0 + a), (x0 + a, y0 + a).

Two vertices are given, calculate the two others (and check the ranges).

Total complexity : O(1)

Sample solution: 7495194

459B - Pashmak and Flowers

If all numbers are equal then answer will be n * (n - 1) / 2, otherwise the answer will be cnt1 * cnt2, where cnt1 is the number of our maximum elements and cnt2 is the number of our minimum elements.

Total complexity : O(n)

Sample solution: 7495202

459C - Pashmak and Buses

For each student consider a sequence of d elements from 1 to k that shows the bus number which is taken by this student on each day. Obviously, there are kd different sequence at all, so if n > kd, pigeonhole principle indicates that at least two of this sequences will be equal, so that two students will become close friends and no solutions exist. But if n ≤ kd, then we can assign a unique sequence to each student and compute the answer. For computing that, we can find the first n d-digits numbers in k-based numbers.

Total complexity : O(n * d)

Sample solutions: 7495236

459D - Pashmak and Parmida's problem

First of all, we can map the given numbers to integers of range [1, 106]. Let li be f(1, i, ai) and let ri be f(i, n, ai), we want to find the number of pairs (i, j) such that i < j and li > rj. For computing lis, we can store an array named cnt to show the number of occurence of any i with cnt[i]. To do this, we can iterate from left to right and update cnt[i]s; also, li would be equal to cnt[ai] at position i (ri s can be computed in a similar way).

Beside that, we get help from binary-indexed trees. We use a Fenwick tree and iterate from right to left. In each state, we add the number of elements less than li to answer and add ri to the Fenwick tree.

Total complexity : O(n * logn)

Also we can solve this problem using divide and conquer method. You can see the second sample solution to find out how to do this exactly.

Sample solutions: 7495225 7495225

459E - Pashmak and Graph

In this problem, a directed graph is given and we have to find the length of a longest strictly-increasing trail in it.

First of all consider a graph with n vertices and no edges, then just sort the given edges by their weights (non-decreasingly) and add them to the graph one by one.

Let dp[v] be the length of a longest increasing trail which ends in the vertex v. In the mentioned method, when you're adding a directed edge xy to the graph, set dp[y] value to max(dp[y], dp[x] + 1) (because of trails which ends in y and use this edge). You need to take care of the situation of being some edges with equal weights; for this job we can add all edges of the same weights simultaneously.

Total complexity : O(n + m * logm)

Sample solution: 7495216

Full text and comments »

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

By Erfan.aa, 10 years ago, In English

Hello everybody!

I just want to invite you to participate in Codeforces Round #261 (Div.2 only), which will be held on August 15th, 19:30MSK.

This round is prepared by ShayanH, Haghani and me. Special thanks to mruxim for helping us to prepare the problems. Actually, this is our first round and we hope you'll enjoy the contest.

Traditionally, we thank Gerald for helping us to get the contest prepared and also MikeMirzayanov, for the great Polygon system.

Main characters of our stories are two interesting persons, named "Pashmak" and "Parmida"; such a lovely couple! <3

Score distribution will be announced soon.

Have fun. ;)

UPD1: Dynamic scoring system will be used.

UPD2: We recommend you to read all problems, although they're sorted by their estimated difficulty.

UDP3: We also thank Aksenov239 who helped us a lot in fixing the Russian statements.

UDP4: It's over!

Congratulations to all people who solved the five problems.

These are the 7 top official contestants:

  1. vanhanh.pham

  2. ElemeNtLz

  3. MLboy

  4. mssjtxwd

  5. yyfkiller3

  6. phidang

  7. roben_76

Editorial will be published soon.

UDP5: We're sorry for the delay. We put a brief editorial here.

Full text and comments »

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

By Erfan.aa, 11 years ago, In English

I found a really small bug in Codeforces profiles. It's funny, try it:

  1. Navigate to your own profile.
  2. Go to settings.
  3. Click on "Save changes" button.
  4. Go back to your profile and check your last visit time!

You'll face this funny bug:

This bug isn't an annoying one, but I hope my post will help admins in improving Codeforces. :)

Full text and comments »

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

By Erfan.aa, 11 years ago, In English

7th programming contest of Allame Helli high school is about to begin shortly.

For more info check http://hellinet.ir.

Registration is available for pupils in Iran.

For registration: http://hellinet.ir/regtype.php

Good luck. ;)

Full text and comments »

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

By Erfan.aa, 12 years ago, In English

Hey guys! I've found something strange about the Codeforces judge. Please read this submission: 3373203 (for problem C) (with n <= 3 * 10^5 and -10^9 <= a[i] <= 10^9)

I think the verdict for this submission should be "TLE" because of its O(answer) algorithm. Answer for this problem can be as large as 10^13. (During the contest, I hacked this submission twice and got "Unsuccessful hacking attempt" (and -100 points!))

Am I wrong? Is the code judged correctly?

Full text and comments »

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