matcoder's blog

By matcoder, 7 months ago, In English,

This is in regards to today's Forethought Future Cup contest.
I tried to hack on this solution because it seems that it's time complexity is O(n^2) where n=10^5, but somehow it takes only 170 ms (on custom tests) to run (worst case).
I am not sure if Codeforces uses some optimisation algorithm for a repetitive function call (String.substr() in this case).
Someone please help me to clarify the doubt.

Read more »

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

By matcoder, history, 9 months ago, In English,

This is in reference to the problem A 'Parity' of today's round.


The following submissions were in my room. I tried hacking one of these solution and got the 'unsuccessful' verdict.
The bug in the codes seems to be the overflow. If you try to print the final sum in these solutions, you get to see the overflowed value (i.e. in some cases it gives negative values too), even in the custom invocation.

Link to the submissions:
Code1
Code2


Read more »

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

By matcoder, history, 12 months ago, In English,

First of all, I would like to thank Codeforces for providing such a great platform for competitive programming.

Following some of the recent changes in the site, I found that several new features have now been added. Now, you can solve problems titled with an estimated rating. Along with this, you may solve the problems topic-wise. And if you want you can sort the problems in increasing or decreasing order of difficulty.

I would like to ask if there exists a feature too, by which we can select all 'A' headed problems or 'B' or 'C' and so on... and sort them in order of difficulty accordingly. I believe that this would help enhancing the problem solving ability.

Forgive me if this is proposed before or currently is in progress. But if not so I would request Codeforces team to implement this feature. Thanks

Read more »

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

By matcoder, history, 15 months ago, In English,

Segmented sieve of Eratosthenes can be used to evaluate prime numbers less than n, where n is large enough in pretty less time and memory.

Time complexity: O(n.log(log(n)))

Space complexity: O(sqrt(n))

Link:

https://primesieve.org/segmented_sieve.html

Read more »

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