![:)](./images/smilies/icon_smile.gif)
502 - DEL command
Moderator: Board moderators
Multiple input
Although not mentioned in the problem description, the problem input is in the multiple input format as indicated by the green submit icon in the contents list.
If your program knows this and still gets WA, your problem is somewhere else.
If your program knows this and still gets WA, your problem is somewhere else.
this problem is easy, i'm surprised it only has 4-5% of AC.
as Picard put it, all you have to do is cook the tightest rule to describe the set of files to delete, then check wether this rule (wildcard) is incompatible with all files to keep.
there are 3 kind of rules:
1- the name of all files to be deleted have the same length.
2- the name of all files to be deleted have length greater than MIN
3- the name of all files to be deleted have character X in position P
1- is stronger than 2- (thus should be preferred)
this applies to both the name and extension of course.
either rule 1 or rule 2 should be considered each time.
rule 1 results in a wildcard of the form: *******
and rule 2: *****?
then rule 3 is used to replace the *'s by letters (or numbers)
i'm pretty sure you can't get a stronger specification of the files.
the checking part is straightforward. just note that in case NO file is to be kept, a good DEL *.* will do the trick![:)](./images/smilies/icon_smile.gif)
as Picard put it, all you have to do is cook the tightest rule to describe the set of files to delete, then check wether this rule (wildcard) is incompatible with all files to keep.
there are 3 kind of rules:
1- the name of all files to be deleted have the same length.
2- the name of all files to be deleted have length greater than MIN
3- the name of all files to be deleted have character X in position P
1- is stronger than 2- (thus should be preferred)
this applies to both the name and extension of course.
either rule 1 or rule 2 should be considered each time.
rule 1 results in a wildcard of the form: *******
and rule 2: *****?
then rule 3 is used to replace the *'s by letters (or numbers)
i'm pretty sure you can't get a stronger specification of the files.
the checking part is straightforward. just note that in case NO file is to be kept, a good DEL *.* will do the trick
![:)](./images/smilies/icon_smile.gif)
We never perform a computation ourselves, we just hitch a ride on the great Computation that is going on already. --Tomasso Toffoli
Re: 502 - DEL COMMAND
following is my WA code, I have tried the input mention above and gotten correct answer.
But it can not pass.
I just can not figure out where is the error part.
Any tricky input or any flaws this code?
thks
But it can not pass.
I just can not figure out where is the error part.
Any tricky input or any flaws this code?
thks
Code: Select all
delete after AC
any one need my code for more thinking or any discussion, welcome to PM me.
Last edited by ansiemens on Sun Sep 19, 2010 9:56 pm, edited 2 times in total.
Re: 502 - DEL COMMAND
Sorry, I have found the error.
The input size of each line would be at most [+-]+8 chars+'.'+3+'\0' => 14, and I used only ten char to handle.
The input size of each line would be at most [+-]+8 chars+'.'+3+'\0' => 14, and I used only ten char to handle.
ansiemens wrote:following is my WA code, I have tried the input mention above and gotten correct answer.
But it can not pass.
I just can not figure out where is the error part.
Any tricky input or any flaws this code?
thks
-
- Experienced poster
- Posts: 139
- Joined: Wed May 18, 2011 3:04 pm
Re: 502 - DEL command
Code: Select all
-AAAAAAA.223
-AAAAAAA.22
-AAAAAAA.227
-AAAAAAA.233
+AAAAAAA.2
Code: Select all
DEL·AAAAAAA.2?*
metaphysis: http://uhunt.onlinejudge.org/id/95895
My solutions for UVa problems: https://github.com/metaphysis/Code.
My solutions for UVa problems: https://github.com/metaphysis/Code.