Page 1 of 1

645 - File Mapping

Posted: Mon Aug 22, 2005 9:04 pm
by JamesAguilar
Hello all,

I'm having trouble getting 645 to work. This is the input I have developed:

Code: Select all

file1
file2
dir3
dir2
file1
file2
]
]
file4
dir1
]
file3
*
file2
file1
*
*
dOMGZ
fTHEFILE
fTHEFILE2
]
dOMGZOMGZOMGZ
dOMG
]
]
fILE2
*
#
For which my output is:

Code: Select all

DATA SET 1:
ROOT
|     dir1
|     dir3
|     |     dir2
|     |     file1
|     |     file2
file1
file2
file3
file4

DATA SET 2:
ROOT
file1
file2

DATA SET 3:
ROOT

DATA SET 4:
ROOT
|     dOMGZ
|     fTHEFILE
|     fTHEFILE2
|     dOMGZOMGZOMGZ
|     |     dOMG
fILE2
The original output from the example is:

Code: Select all

DATA SET 1:
ROOT
|     dir3
|     |     dir2
|     |     file1
|     |     file2
|     dir1
file1
file2
file3
file4

DATA SET 2:
ROOT
file1
file2
The ambiguity that might be tripping me up is that the problem description says "All files should be in alphabetical order within each directory." However, it's hard to tell whether that means that the directories should also be sorted alphabetically. It seems like, if it's not specified, both should be accepted, but I am not sure whether that is the problem.

If this is the problem, then I will have to adjust my program a bit. Can you advise whether that is something I should look at (i.e. that the directories remain unsorted)?

Re: 645 - File Mapping

Posted: Fri Jan 27, 2012 11:04 pm
by brianfry713
Directories should remain unsorted. Print them in the order they appear in the input as in the sample I/O. Here is output from my AC code for your input.

Code: Select all

DATA SET 1:
ROOT
|     dir3
|     |     dir2
|     |     file1
|     |     file2
|     dir1
file1
file2
file3
file4

DATA SET 2:
ROOT
file1
file2

DATA SET 3:
ROOT

DATA SET 4:
ROOT
|     dOMGZ
|     fTHEFILE
|     fTHEFILE2
|     dOMGZOMGZOMGZ
|     |     dOMG
fILE2

Re: 645 - File Mapping

Posted: Sat Feb 27, 2016 12:22 am
by TryCatchMe
brianfry713 wrote:Directories should remain unsorted. Print them in the order they appear in the input as in the sample I/O. Here is output from my AC code for your input.

Code: Select all

DATA SET 1:
ROOT
|     dir3
|     |     dir2
|     |     file1
|     |     file2
|     dir1
file1
file2
file3
file4

DATA SET 2:
ROOT
file1
file2

DATA SET 3:
ROOT

DATA SET 4:
ROOT
|     dOMGZ
|     fTHEFILE
|     fTHEFILE2
|     dOMGZOMGZOMGZ
|     |     dOMG
fILE2
Brian - If directories are supposed to be listed first as per the directions, why do fTHEFILE and fTHEFILE2 come before dOMGZOMGZOMGZ
and it's subdirectory?