|
0
A solution that use the Segment Tree implementation can be found here https://vincenzopalazzo.github.io/Competitive-Programming-and-Contests-VP-Solution/FrogsAndMosquitoes/ |
|
0
In my opinion, this is possible to resolve with Mo's Algorithm but C++ is not a good choice to implement an abstract solution. In some case, you need to use a big vector or Array to get store the frequency but in this case is possible to use a hash map. Unfortunately, the implementation of the C++ map is very bad. Maybe Java can be faster than C++ in this case. Anyway, this is my solution, that uses pure Mo'a algorithm https://codeforces.me/contest/86/submission/103715846 |
|
-8
Maybe is too late, but is good manners don't use the stringstream ss(s); Also in the real life, the stringstream is very slow, and I agree is a little bit trick to read the input from this es. |