645 - File Mapping

All about problems in Volume 6. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
JamesAguilar
New poster
Posts: 1
Joined: Mon Aug 22, 2005 8:48 pm

645 - File Mapping

Post 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)?
brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 645 - File Mapping

Post 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
Check input and AC output for thousands of problems on uDebug!
TryCatchMe
New poster
Posts: 15
Joined: Fri May 30, 2014 12:09 am

Re: 645 - File Mapping

Post 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?
Post Reply

Return to “Volume 6 (600-699)”