Next to Farid's Gallery

I am trying to improve my English language and that's why I have made this blog. Forgive me for my mistakes and if you found free time , give me some advice to rectify my wrong statements.

18 - Life is Pulsing Heavily



- 60 times shocked in 1-hour conversation!

Life is messing with us lately, It seems that it has decided to take us down. Many dreams that we had, have become some bitter memories and now we are facing with some hard to decide situations.

I don't mean that we hadn't good things lately but the bad ones were too heavy and life-changing. You think you are fine and have thought about everything, start to talk and get shocked over and over! Actually, the titles are the short stories of our last days, about every day.

We don't know even what is going to happen in next hour. Choosing the right path and moving through it has become overwhelming because this is not a simple intersection. We have to choose between a _very risky but dreamy_ and _less complicated and promising_ things. Which one would you choose?


- Life is Pulsing Heavily

Obviously, Everyone's life is pulsing, going up and down many times over the time. But in last months the pulses were too heavy for us, changed the directions and our imagined life.

Sad days count are taking over the happy ones. It is totally up to two of us now, If we act strongly, everything will be fine in next years and if we failed, the counting would go forward in the same way! ( more hope for first one :)


 :|

Honestly, I don't like the last posts, because they all have some sad tastes. I hope we will do our best in next months and I will write happy posts soon ...

۱۳ خرداد ۹۶ ، ۰۰:۴۶ ۱ نظر موافقین ۱ مخالفین ۰
محمد افتخاری

17 - It's going to be 6 years!


- It would be If 11<8 was true!

"Well done Mohammad. It seems that you will be graduated sooner than semester 8!" said my cousin 3 years ago , in front of his child to make a point for him!

I'm sorry for disappointing him but I am glad that I have never believed that certification is the main purpose of going to the university. It became stronger when I stepped into the Competitive Programming world thanks to Yashar, and to Faraz for refuling me in this road. Actually in university you have to learn how to study and how to live. Have hard situations and carry them on by your own and grow up to become a man.

For being late, I have been blamed many times, but I think that they have started to believe my words and some of them are asking me to keep this on!


- It's going to be 6 years!

I will have my 11th semester in autumn of this year, It is going to be my 6th year of education in the Urmia University. I feel like I have lived 15 years here, It has passed and also is passing too hard for me. There was always something to make situation harder and harder, sometimes physically, sometimes emotionally and ... .

Anyway, this is how life is supposed to be. I am planning to have some changes in my life. Important changes in my life that need Strong changes in myself.

۱۵ فروردين ۹۶ ، ۱۹:۴۱ ۱ نظر موافقین ۱ مخالفین ۰
محمد افتخاری

16 - The Unfinished Job


- I can't change my direction !

Holidays are good time for thinking about what has happened to you. I have been thinking about my memories in last 5 years, since I started my university.

What I expected to be and What I have become to. What I wanted to have and What I have now.

Many times I complained about things that I lost , things that I couldn't ever have , ... . But when I was watching them again, I cleaned all of my memories after each of them and tried to imagine my current day providing that it has happened. Some of them seemed great like dreams , full of hope and happiness , many things that a man can wish for. Some of them were horrible , tough days , hard situations , bad things could have happened and ...

When I was checking the reachable ones ( not fantasy ones! ). I could see something is missing from all of them. Something that can be the reason for why I can't change direction of my life , for why I have failed everytime that I have decided to do something big that could have changed my storyline.


- The Unfinished Job !

Hmmm ... It seems that I have found the reason finally. Something has to be done before things that I was dreaming for. Something that later I wanted to be done but I had forgotten it in this many years and events. I know that it will take time but it's time to focus on it more than before ...

۰۴ فروردين ۹۶ ، ۱۳:۴۹ ۱ نظر موافقین ۱ مخالفین ۰
محمد افتخاری

13. Last Day in Next to Farid's Gallery


- Last Day in Next to Farid's Gallery

Two months passed so fast. Two months at the center of the Maragheh, Beside Farid's Gallery, fun , tough and memorable days. 

We did our best in last three months , though , it wasn't perfect but acceptable. We have learned about every needed topic for our regional and our next job is to understand them deeply and being faster at using them.

I firmed my place at Div1 , Faraz reached the dark blue and Yashar became Welder :) ! I don't know how it is related to programming contests but , you know Mr.Captain ... anyway, I hope we will work more at next 3 months before the contest.

We have prepared new statistics of the number of solved problems. You can check it in Faraz's Blog ... 


۲۰ شهریور ۹۵ ، ۲۱:۳۳ ۰ نظر موافقین ۱ مخالفین ۰
محمد افتخاری

12. A week with "Sabokbar" song | Meet in the middle

- "Sabokbar" song

How soft and silvery is Salar Aghili's voice. I like to hear his songs when I am coding or tired. The "Sabokbar" track is one of the soothing musics that I have ever heard. I have been using his "Khushechin" track as my Ahange Pishvaz since about 6 months ago :)

Also Google's Human documentary movie starts with his voice, a poem from Molana. It shows that even without understanding his words, you can enjoy his voice and music.

Anyway, because I have used to listen pop musics. I like Ehsan Khaje Amiri's musics more than of everyone's.


- Meet in the Middle

One of the special and rare tricks that you can use for solving some of the problems. 

You can read about it here. Also I show you an example of it's usage :


HackerEarth Xoring in Base 10 : You are given n numbers ( 1<=n<=40 ) and an integer k. You have to find maximum possible Xoring of exactly k numbers in base 10 from the array.


Solution :

Note that n<=40 and we can't brute force it because it will be O( 2^40 ) !!!


Let's first consider the best Xor part. Suppose problem says that you have an array of integer numbers and you have a number x , select best number from the array that (x xor ai in base 10) became maximum.

Now Let's create a Trie with all numbers in the array. ( You have to choose a fixed len for number such as 9 digits )

Then finding the best possible number for x needs O( log n ) time ( Greedily, at each level choose a way that maximizes the xor )

( For learning it, Try Little Xor problem when n <= 10^5 )


OK , now how we can do the same here , when we have to choose k numbers and n <= 40 !?


- Split the array to two arrays from the middle. I will call "Left" to the first half and "Right" to the second half.

- Create k Tries. ( 0 : empty , 1 : for single numbers , 2 : 2 numbers , 3 : 3 numbers , ... )

- Do brute force on Left and find all possible subsets of it and add them to the appropriate trie.

- Do brute force on Right and check all possible subsets of it in created Tries. i.e. if a subset contains 3 numbers , you have to try to find best possible solution for it in Trie[k-3].

- Get maximum of all of them. you got the answer.

- Complexity : 2 * O( 2^20 * log(ai) )

( You can check the implementation here. )


I hope, you found the article useful.

۱۸ شهریور ۹۵ ، ۰۰:۰۴ ۰ نظر موافقین ۱ مخالفین ۰
محمد افتخاری