ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1613. For Fans of Statistics

Accepted map<int, set<int> > + lower_bound 0.499
Posted by nadinne 6 Feb 2016 13:30

Edited by author 06.02.2016 13:30

Edited by author 06.02.2016 13:38
Re: Accepted map<int, set<int> > + lower_bound 0.499
Posted by ToadMonster 8 Feb 2016 15:24
My result is 0.1 sec, 700 Kb memory usage.

I used VS 2013 (probably its IO works quicker then gcc), C-style (printf/scanf) IO, sorted vector of pairs (count_of_passengers, city_number).
Re: Accepted map<int, set<int> > + lower_bound 0.499
Posted by alexey saybel 7 Apr 2016 19:11
Have a similar solution for Java: HashMap<Integer, TreeSet<Integer>> and floor/ceiling functions. I've got execution time: 0.998 it's kinda funny ))
No subject
Posted by Alexey Vasilyev 26 Mar 2019 19:44


Edited by author 28.03.2019 12:57
Re: No subject
Posted by Hristo Nikolaev (B&W) 22 Dec 2022 18:52
I used the same approach - works much faster 0.218
make sure you are not making unintended copies of the set and use a reference -

std::set<int>& current_set = m[x];
instead of
std::set<int> current_set = m[x];