I noticed that all accepted submissions but one got Presentation Error, including mine. Two things:
- why is it permitted to have P.E. in a problem where it's all about removing spaces and empty lines?
- I'm almost certain my program outputs the correct format, so why do I get P.E.?
I'll temporarily attach my code to this posting, maybe someone can find my mistake. Please don't leach it!
Why?
Because any comment is a blank for compiler. So if we remove comment we can put a blank instead of it.
BTW. Very nice input
Best regards
DM
PS. [2 hours later] Why I am not surprised, that I am not get Acc , but WA?
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)
Program x(input,output);
var x :integer;
begin end.
?
Could anyone who got accepted post some critical IO ? I try to find my mistake, but I don't have any idea what I can do wrong ...
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)
{Don't replace sequences of blanks with a single blank after removing comments
} {For more details read problem statement
}
(*
*
)
*)(* My pascal program fails on comment above *) Program p723(input,output);
{$D-,L-,I-,Q-,R-,S-,Y-}
var x {
}:integer;
procedure repeatuntilfalse;begin end;
begin
(* comments are removed and not replaced by blank!*)
(* This is an example that input and output programs can be different!!!*)
repeat{}until{}false;
end.
{My ACCEPTED Pascal programs works 0.131 seconds with 320Kb memory spent}
{Any hints how speed up Pascal I/O?}
{SetTextBuf function is restricted!}
Nice input. I think that I know now what I am doing wrong ...
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)
I follow instructions from problem description and topic but I still got WA.
Could you help me avm ?
Best regards
DM
PS. Avm, I post you my code in C via private message. Maybe you could help me? If not - it will be good too
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)
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)
I cannot see where in the problem statement is says that the comments inside the string constants should not be removed (it certainly says so about the multiple spaces in a row, but not comments)...
I tried all testcases in this topic and my program produced correct output.
After many tests I discovered that my program finds a string-constant in the input which is not terminated at the end of the line.
Could anyone verify this?
Of course it should not happen as it is invalid pascal. Hence I guess it doesn't which means I must handle comments the wrong way as my program then must miss some '-s.
I hope you can help me or provide additional testcases.
My program passes all the test cases here (the good ones anyway)
My questions are:
- Do we remove all trailing spaces from the end of a line?
- If the last line in the file does not end with a \n, should a \n be displayed?
- In pascal, this is a valid comment: { *).. not here?
- This sounds kinda dumb, but if you read the problem state literally, it's saying that we should even remove comment blocks within strings, is this correct?
[EDIT]
- No
- ?
- Yes
- No
- Look out for multiline strings! (AC)