342 - HTML Syntax Checking
Moderator: Board moderators
-
- Guru
- Posts: 834
- Joined: Wed May 29, 2002 4:11 pm
- Location: Wroclaw, Poland
- Contact:
342 - HTML Syntax Checking
I have a few questions to this problem:
1. Sample imput isn't correct. Test case 5 tells that 2 lines of text follow, but is only one line of text.
2. Can we handle < and > as start and end of the tag (as in first case in the sample)? Such situations are incorrect in HTML as far as I remember.
3. Can we handle tags without body (something like <TAG />? Specification don't say any word about that.
I use stack to check nested tags and I hope that my program is correct, but I got WA only. Could anyone help me ?
Bets regards
DM
1. Sample imput isn't correct. Test case 5 tells that 2 lines of text follow, but is only one line of text.
2. Can we handle < and > as start and end of the tag (as in first case in the sample)? Such situations are incorrect in HTML as far as I remember.
3. Can we handle tags without body (something like <TAG />? Specification don't say any word about that.
I use stack to check nested tags and I hope that my program is correct, but I got WA only. Could anyone help me ?
Bets regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)
Born from ashes - restarting counter of problems (800+ solved problems)
-
- Guru
- Posts: 1080
- Joined: Thu Dec 19, 2002 7:37 pm
The sample I/O was not correct, so I made a description one called p342.html. In updating the new page, the judges must have forgotten to overwrite the old description (342.html) with the new one, but instead copied it. So the correct description can be found at http://acm.uva.es/p/v3/p342.html.
Sorry for the inconvenience; I'll notify the judges immediately.
As for your questions 1&2: see new description.
What do you mean by "tags without body"? The only valid tags are opening tags (without the slash) and closing tags (with a slash immediatly following the '<'), and they should always appear in pairs, as given in the description.
Sorry for the inconvenience; I'll notify the judges immediately.
As for your questions 1&2: see new description.
What do you mean by "tags without body"? The only valid tags are opening tags (without the slash) and closing tags (with a slash immediatly following the '<'), and they should always appear in pairs, as given in the description.
-
- Guru
- Posts: 834
- Joined: Wed May 29, 2002 4:11 pm
- Location: Wroclaw, Poland
- Contact:
Unfortunatly link which you post doesn;t work
(I got HTTP error 404).
So, could you send me this new HTML page ??
Tag without body is something like <br /> , which is shorthand from <br></br>.
Best regards
DM

So, could you send me this new HTML page ??
Tag without body is something like <br /> , which is shorthand from <br></br>.
Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)
Born from ashes - restarting counter of problems (800+ solved problems)
-
- Guru
- Posts: 1080
- Joined: Thu Dec 19, 2002 7:37 pm
In the meantime Carlos fixed the problem, so the new desciption can be found at the normal adress (http://acm.uva.es/p/v3/342.html). You might need to reload the page in your browser to refresh your cache.
No, all tags should be matched.
No, all tags should be matched.
-
- Guru
- Posts: 834
- Joined: Wed May 29, 2002 4:11 pm
- Location: Wroclaw, Poland
- Contact:
-
- Guru
- Posts: 834
- Joined: Wed May 29, 2002 4:11 pm
- Location: Wroclaw, Poland
- Contact:
I have one question:
Why, in case 9, output is?
Tag has 11 characters, so I think, that output should be
This situation violates two rules. Which one should be used?
Best regards
DM
Why, in case 9, output is
Code: Select all
bad character in tag name.
Tag has 11 characters, so I think, that output should be
Code: Select all
too many/few characters in tag name.
Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)
Born from ashes - restarting counter of problems (800+ solved problems)
-
- Guru
- Posts: 1080
- Joined: Thu Dec 19, 2002 7:37 pm
The problem description doesn't specify what to do if both errors occur simultaniously. In case 9 the eleventh character is illegal, but also makes the tag too long, so both errors would apply for that tag. I had to make a choice, so I chose to issue the errors in the same order as they were given in the text, which means in case 9 the output is "bad character in tag name".
I added three cases to the sample input to (implicitly) illustrate which choice I made.
In case 8 the bad character appears before the character that makes the tag too long;
In case 10 the bad character appears after the character that makes the tag too long.
I added three cases to the sample input to (implicitly) illustrate which choice I made.
In case 8 the bad character appears before the character that makes the tag too long;
In case 10 the bad character appears after the character that makes the tag too long.
-
- Guru
- Posts: 834
- Joined: Wed May 29, 2002 4:11 pm
- Location: Wroclaw, Poland
- Contact:
Thanks little joey for explanation.
Now my output is exactly the same as in samples, but I got WA again.
I don't think, that my stack algorihtm fails, but I must miss some critical cases. But I don't know which one I missed ! I think, that must be something more with output - maybe any other message should appear?
Could you take a look at outputs from my code ? Can I send you my code ?
Best regards
DM
Now my output is exactly the same as in samples, but I got WA again.
I don't think, that my stack algorihtm fails, but I must miss some critical cases. But I don't know which one I missed ! I think, that must be something more with output - maybe any other message should appear?
Could you take a look at outputs from my code ? Can I send you my code ?
Best regards
DM
If you really want to get Accepted, try to think about possible, and after that - about impossible ... and you'll get, what you want ....
Born from ashes - restarting counter of problems (800+ solved problems)
Born from ashes - restarting counter of problems (800+ solved problems)
Hi all!
I'm getting WAs.
Could you say me what is the output for this?
[EDIT] Now cases 3 and 4 are correct as regards problem's specification [/EDIT]
my output:
And a small commentary, in the problem's specification there are this:
Thanks in advance!
I'm getting WAs.
Could you say me what is the output for this?
[EDIT] Now cases 3 and 4 are correct as regards problem's specification [/EDIT]
Code: Select all
2
<EMILIOJOSE> </EMILIOJOSE>
2
<EMILIOJOSe> </EMILIOJOSe>
2
<EMILIOJOSE> </EMILIOJOSe>
2
<EMILIOJOSEe> </EMILIOJOSEe>
2
<EMILIOJOSEE> </EMILIOJOSEE>
2
>
2
/>
2
</>
2
</ >
2
< >
3
<ASDFG>
4
<ASDF>
</>
4
<ASDF>
</ >
4
<ASDF>
</ASD>
0
Code: Select all
Test Case 1
OK
Test Case 2
line 2: bad character in tag name.
Test Case 3
line 2: bad character in tag name.
Test Case 4
line 2: bad character in tag name.
Test Case 5
line 1: too many/few characters in tag name.
Test Case 6
line 1: bad character in tag name.
Test Case 7
line 2: bad character in tag name.
Test Case 8
line 2: too many/few characters in tag name.
Test Case 9
line 2: bad character in tag name.
Test Case 10
line 2: bad character in tag name.
Test Case 11
line 3: no matching begin tag.
Test Case 12
line 4: too many/few characters in tag name.
Test Case 13
line 4: bad character in tag name.
Test Case 14
line 4: expected </ASDF>
In the sample output:line #: bad character in tag name
line #: too many/few characters in tag name
line #: expected </xxxxxxxxxx>
line #: no matching begin tag.
I think that clearly the correct for output are the second ones (if you notice the first and second statement haven't the spot at line's finish).line #: bad character in tag name.
line #: too many/few characters in tag name.
line #: expected </xxxxxxxxxx>
line #: no matching begin tag.
Thanks in advance!
Last edited by Emilio on Sun Nov 06, 2005 9:17 pm, edited 3 times in total.
-
- Guru
- Posts: 1080
- Joined: Thu Dec 19, 2002 7:37 pm
My output is:
Your cases 3 and 4 are invalid (three lines, while n=2). Cases 5 and 6 contain no tags (a tag should have both '<' and '>'), just text and therefor are 'OK'.
Thanks for noticing the difference between the description and the sample output. I corrected some other errors in the problem, but never noticed this one... There should be a dot after the first, second anf fourth error message, as in the sample output.
Code: Select all
Test Case 1
OK
Test Case 2
line 2: bad character in tag name.
Test Case 3
line 2: bad character in tag name.
Test Case 4
line 2: bad character in tag name.
Test Case 5
line 1: too many/few characters in tag name.
Test Case 6
OK
Test Case 7
OK
Test Case 8
line 2: too many/few characters in tag name.
Test Case 9
line 2: bad character in tag name.
Test Case 10
line 2: bad character in tag name.
Test Case 11
line 3: expected </ASDFG>
Test Case 12
line 4: too many/few characters in tag name.
Test Case 13
line 4: bad character in tag name.
Test Case 14
line 4: expected </ASDF>
Thanks for noticing the difference between the description and the sample output. I corrected some other errors in the problem, but never noticed this one... There should be a dot after the first, second anf fourth error message, as in the sample output.
Hi,
My program is with wrong answer and all this tests here gave me the same output.
What is the correct solution for this test?
Sample input
Mine output :
My program is with wrong answer and all this tests here gave me the same output.
What is the correct solution for this test?
Sample input
Code: Select all
2
<TESTE>
</TTESTE>
2
<TESTEA><TESTEB>
</TESTEA></TESTEB>
0
Code: Select all
Test Case 1
line 2: expected </TESTE>
Test Case 2
line 2: expected </TESTEB>
More cases
In this case:
My W.A. solution is giving:
What is the correct solution for this test case?
thanks for the help
Code: Select all
4
<A> </A>
<AB><ABC>
</ABC>
1
blabla<BLA>blabla</Blalalalla>
1
blabla<BLA>blabla</BLALALALALLALALA>
2
blabla<BLA>blabla<BLALALALAL>
</BLALALALAL>
0
Code: Select all
Test Case 1
line 4: expected </AB>
Test Case 2
line 1: bad character in tag name.
Test Case 3
line 1: too many/few characters in tag name.
Test Case 4
line 2: expected </BLA>
thanks for the help