LCH15JEF - Editorial

@gdisastery1 If you see 10 more problems like this, you could get a WRONG impression that Java/Python are better because there are prewritten classes for big numbers, for example.

@alexvaleanu If you are a beginner, you might get this wrong impression. So you are implying C++ is better than Java/Python? Even though it is the most preferred language in competitive programming (I also use C++ mainly), it is not the best - it really depends on the problem.

thanks for the looking into my code! :slight_smile: another of doubts was how was it possible to have xi and yi of the order 10^999 or so; since the string length was restricted to a lesser value (10^4)?
Thanks for your time :slight_smile:

@gdisastery1 This is the point that I am trying to prove. I am not saying which language is better. It does not matter. A language should not be favored by a problem.

Again, I am truly for my mistake. If a Python user should code a very complicated data structure, a C++ user should too. Problems should not be about different aspects of programming languages.

@alexvaleanu I mean, that for python coder, coding a complicated data structure is usually out of their range

@alexvaleanu There are always two sides of a problem in a PROGRAMMING CONTEST - first the theoretical solution - with pseudocode maybe, and second the implementation. If you are saying the problems should not be dependent on the language, each problems would only have the first part - and we would all be writing pseudocode or explaining the solution theoretically. Boring, isn’t it?

If you are picking the wrong tool for the wrong problem, then it’s your fault for coding too long. It’s like cutting a cucumber with a hammer.

3 Likes

@ankitdhall, just notice that 10^9997 has 9998 digits and a string of length 10^4 can have 10000 digits :wink:

Looks like I should learn java

same thing happened to me. c++ bigint code gets TLE

Your code will only work for the first subtask. IT will timeout for the rest.

can anyone explain the author’s solution? I have no idea how, exponetiation happened in it…

Nice problem, I guess it’s unfortunate that it could be solved so easily with other languages.

Why doesn’t the editorial describe this solution instead of talking about the obvious brute force bignum algorithm? The reason everyone is raging here is because it looks like the official and expected solution is to use Python/Java because that’s the only solution described in the editorial. If your solution had been posted as the editorial then I doubt as many people would have complained.

1 Like

Refer this: EXPONENTIATION- LCH15JEF - general - CodeChef Discuss

Refer this: EXPONENTIATION- LCH15JEF - general - CodeChef Discuss

String cannot be input this manner. Its of the format (a1)(a2)(a3)…an where each ai is of the form bi**bj.

It’s still possible to write a solution quite a bit shorter than the ones most contestants have done.

http://www.codechef.com/viewsolution/5994630

It is updated now, but in general deciding a difficulty after the contests is better, because a number of contestants who solve it correctly affect the level of difficulty. For example, there can be an unexpected method of solving it which comes up during a contest.

It was a good problem and can be coded easily in C++ if one remembers basic arithmetic operations and the logic behind them. I did it easily.

1 Like