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 1067. Disk Tree

Accepted 0.156 2 993 КБ
Posted by TakeOver 10 May 2013 02:05
Just used STL contaners such as std::map<std::string,T>, std::vector<T>. :)
33 lines of code.
Re: Accepted 0.156 2 993 КБ
Posted by alp 2 May 2014 11:27
what is "T"?
give please full description.
AC in 0.093 , 7 748 KB
Posted by Hristo Nikolaev (B&W) 29 Dec 2022 02:14
I used a map and a set. My time was a little less than 2 times faster, and used a little more than 2 times more memory.

struct dir {
    std::string name;
    std::map<std::string, dir*> children_items;
    std::set<std::string> children_names;
};

The set gives you the sorted list.
The map gives you instant access to a subdirectory of a given directory by name (taken from the set)

Edited by author 29.12.2022 02:15