ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1094. E-screen

Problem 1094 "E-screen" has been rejudged (+)
Posted by Vladimir Yakovlev (USU) 7 Jan 2007 07:33
Old tests were fixed: end-of-line characters were added in the end of input.
New tests were added. Validator program was updated.
Timelimit was decreased to 0.25 sec.

After rejudge 26 authors got AC, but 512 lost AC.

Edited by author 07.01.2007 07:34
Re: Problem 1094 "E-screen" has been rejudged (+)
Posted by MegaSerg 8 Jan 2007 01:45
I changed one symbol im my program and got AC once more.
Maybe is there a bug again?
Maybe your new program is correct? (-)
Posted by Vladimir Yakovlev (USU) 8 Jan 2007 06:13
Check the tests again, please
Posted by Ostap Korkuna (Lviv NU) 8 Jan 2007 20:42
In the problem statement it is said:
"The single line of the input contains..."
The SINGLE LINE means no '\n' characters!

but this program gets Crash(1):

#include <stdio.h>
int main()
{
    char c;
    while (scanf("%c", &c) == 1)
    {
        if (c == '\n')
            throw(0);
    }
    return 0;
}

And this one gets TL(1)

#include <stdio.h>
int main()
{
    char c;
    while (scanf("%c", &c) == 1)
    {
        if (c == '\n')
            while(1);
    }
    return 0;
}


Isn't it strange ???

Edited by author 08.01.2007 20:43
The single line supposes '\n' character in the end (-)
Posted by Vladimir Yakovlev (USU) 9 Jan 2007 02:03


Edited by author 09.01.2007 13:53
Re: The single line supposes '\n' character in the end (-)
Posted by Ostap Korkuna (Lviv NU) 10 Jan 2007 02:37
Interesting :-)
I always thought that '\n'-character is the splitter for lines . That means if the number of '\n'-characters is K, so the number of lines is K+1...
I think, that you should write in problem statement - "there is endline character after input" or "input is ended by endline char"

I don't insist to change problem statement or tests, I just want to tell my opinion.

I am sure, if you open the file with one of your test in text editor you will see 2 lines (the second one is empty).
It is not very "interesting" to get WA because of that :-)
Re: The single line supposes '\n' character in the end (-)
Posted by Life is short... 11 Jan 2007 15:37
If you open a file in a hexedit then you'll see that 0A0D symbols are the end of line, followed by EOF. So there is exactly 1 line, but notepad lets you to move your cursor on another line just because there was end of line though there isn't second line endeed.