Live Archive flaw in input

Do you want to discuss about these problems? Go now!
Users are shared (no need to re-register).

Moderator: Board moderators

Post Reply
Maniac
Experienced poster
Posts: 105
Joined: Tue Oct 14, 2003 3:24 pm
Location: Utrecht, Holland

Live Archive flaw in input

Post by Maniac » Tue Oct 12, 2004 1:28 pm

I'm very confident that there is a flaw in the input of problem 2934 Who's the boss of the Live Archive (the problem is part of NWERC 2003 regional). The problem states this
Then there are q lines listing queries. Each query is a single legal employee ID.
But after many trials I found that there are test cases with queries where this is not the case (the employee ID in the query doesn't match the ID of any given employee).

Does anyone know how I should handle these queries? Or maybe an admin could check the input?

Thanks, Erik

P.S. sorry for posting here, but the Live Archive Board does not contain a section for the NWERC 2003 regional :-(

Maniac
Experienced poster
Posts: 105
Joined: Tue Oct 14, 2003 3:24 pm
Location: Utrecht, Holland

Post by Maniac » Wed Oct 13, 2004 3:08 pm

:evil: :oops:
Turns out that there's nothing wrong with the input, but with the Java compiler (again). I changed
[java]employee[i+1] = new Employee(nextInt(), nextInt(), nextInt());[/java]
into
[java]int a = nextInt();
int b = nextInt();
int c = nextInt();
employee[i+1] = new Employee(a,b,c);[/java]
and got AC.

Apparently the Judge's Java compiler doesn't evaluate the upper expression in the right order cause the result Employee was all mixed up (and didn't meet the problem description restrictions anymore). This issue also turned another long standing WA into AC! Java users beware....

Dominik Michniewski
Guru
Posts: 834
Joined: Wed May 29, 2002 4:11 pm
Location: Wroclaw, Poland
Contact:

Post by Dominik Michniewski » Fri Oct 15, 2004 11:03 am

I 'm not sure, but your first line can be evaluated in many different ways ... I don't know specification of Java so good, but I think, that behaviour of such code could be strange, as you noticed ;-)

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)

Maniac
Experienced poster
Posts: 105
Joined: Tue Oct 14, 2003 3:24 pm
Location: Utrecht, Holland

Post by Maniac » Fri Oct 15, 2004 12:32 pm

So I did :-)
But I'm sure that the Java 1.4 compilers and newer ones evaluate the expression in the 'expected' order, i.e. the parameters in left to right order.

Post Reply

Return to “ACM ICPC Archive Board”