Fear_Is_An_Illusion's blog

By Fear_Is_An_Illusion, 9 years ago, In English

I had very bad contest yesterday.

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

Hello everyone. I had doubts solving this problem. Since problem statement isnt that long, I decided to include it.

Nikhilesh loves factorials. One day he was working on exponents and starts wondering what would be the exponent of a number in the factorial of another number. He defines a function Exp(N,k) as:

Exp(N,k) = largest Y such that kY is a factor of N! .

He calculates Exp(N,k) for all values of k from 2 to N .

Since he is bad at remembering numbers, he computes the sum of Exp(N,k) for all k in range [2,N]. This sum is easy to remember.

Your task is to calculate this sum for a given value of N. Since the value can be large, print its modulus with mod (ans%mod).

I used miller rabin primarility test for generating primes. Then I factorised every number upto N, stored it in a place. Then I found out the frequency of each element and stored it along with that element in a pair. So I had all the prime factors and exponents of the factorial, which I used to solve the question.

However this is extremely slow for large input.

Any other feasible method ?

Thanks for help.

Link To Problem

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

Any cute girl living near District 6 and wants to get started in competitive programming, contact me. We can practice on weekends.

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

I think they should make universal chargers for laptops like they have universal charger for smartphone. I was at my relatives house last codeforces round and couldnt take part as my laptop had zero charge, and their laptop charger dont fit.

I could have used their laptop but they didnt give it to me as they thought i might damage it.

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English
struct mewat1000
{
    string looks="";
}mewat1000;

int main()
{
string your_opinion;
cin >> your_opinion;
mewat1000.looks = your_opinion;

if(mewat1000.looks == "James Bond")
{
    Give++;

}
else
{
    Give--;

}
}

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

I think half of green accounts are fake.

But why open fake accounts ? Does it help get better rank in contests ?

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

I am a big fan of Xellos and I always refer his codes on codechef website.

But when I tried to refer to his code on codeforces and topcoder, I realized that I have a better chance understanding Egyptian Hieroglyphics than his submissions. That made me really sad.

Guys, if you like my posts, give minus. I want to reach -200 without writing anything that would offend anyone.

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

Last week I posted a blog on how I had "apparently" improved in the 2nd previous week. Which to my surprise got a lot of upvotes. Hope to get lots of downvotes this time.

So over this week, I actually posted some meaningful blogs, related to computer programming. Also I learnt to use the new features in C++14. For a long time I wanted to create a simple game, and I managed to make a simple ping pong game using pygame module. It also helped me get some more better understanding of python language.

Participated in Codeforces round 292. It was a nice contest with good and interesting problems.

Regarding algorithms and data-structures, I made my concepts clear on suffix arrays and related areas and plan to solve some sums, and then read a bit about segment trees.

Also I got to interact with many great people, and read some really nice blogs which increased my knowledge.

Finally thanks for reading. Many thanks to those people who cast a vote.

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

The newer versions of C++ have introduced an auto keyword, which basically automatically sets the data type of variable. I can imagine it being useful in situations like these, where it increases coding speed and prevents unnecessary cluttering.


vector< pair <int, int> > foo; for(auto i=foo.begin(),i!=foo.end(),++i) { ..... }

However still it just seems as a small advantage. Also using it in place of int , string, etc just causes a lot of confusion, like dealing with variables in any weakly typed language, say Javascript.

var foo=13.67;

foo="it's a string"

Though using auto prevents assigning a string as an int, but using it everywhere makes debugging a nightmare

Say you shouldnt be doing this in C++

auto x="mewat1000";
auto y=5.33;

So what other useful feature it serves, which I seem to be missing out ?

Upd1 : One of my few posts which didnt get downvoted to oblivion. Rest of the posts disapper from recent blog activity list within 15-20 mins of posting them.

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

My teacher said that when I grow up, I'll be nobody.

The same teacher said some other day that nobody is perfect.

So does that mean when I grow up, I'll become perfect ?

PS... I told teacher that now I am specialist and when I grow up, I want to be grandmaster. He threw me out of the class :'(

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

I really have a crush on a girl in codeforces. She is pretty and really smart.

The problem is she is in upper blue while I keep bouncing between blue and gray boundaries. That is why I cannot find the courage to approach her. How should I deal with my current predicament ?

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

Hi everyone, I kept getting wrong answer in this Problem . Basically it just wants to know what will be the position of last person alive.

It is based on Josephus problem. I used the formula

Can anyone explain please ?

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

Silly mistakes are like syntax errors. They can cause your entire program to become useless. Pity that there is no compiler for detecting them.

So whats the silliest mistake you have ever done in a contest problem ? And when you realized it later, you had that "WTF was I thinking then" kind of feeling.

Yesterday while doing div 2 B, I was pretty confident that my approach was correct, but kept failing a pretest.

I couldnt sleep properly due to that mistake, so I woke up at 3am and found this stupid silly mistake.

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

Hello everyone. So last week I tried my hand in writing blogs. Apparantly I wasnt very good at it and my first blog ended up getting -50 votes.

But that pathetic result didnt make me quit. I took a resolve to get better instead of merely hanging my boots.

So my last 3 blogs have had votes of -31, -28 and -18 respectively.

As it can clearly be seen, I'm improving gradually. Who knows, some time in the future my blogs may generate +200 votes.

Hoping for more improvement in next week.

Lol

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

Finally found a red coder with -50 contribution.

This symbolises non discrimination on basis of rank/color in codeforces.

Or is is that he was downvoted before he became red ?

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

I wish all people with girlfriend/boyfriend a happy valentines day. For single people, dont worry, enjoy the weekend.

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

one bad post, one bad comment, now i am in bottom page of contributors. help needed to get out of there.

Full text and comments »

By Fear_Is_An_Illusion, 9 years ago, In English

Finally, found a list where tourist isnt at the top

Full text and comments »