Page 1 of 4
790 - Head Judge Headache
Posted: Fri Jan 18, 2002 7:46 pm
by rcotta
Hi all,
There's something strange with problem 790. Although I can get the right results with some very complex test cases here, I always get wrong answer.
Does a team that did not submit any problem be listed or not? That is, if team 1 submits and team 4 submits too, do teams 2 and 3 be listed in output too?
The only thing that may cause confusion is this (and this should be explained on problema description).
Thanks
Rafael
Posted: Fri Jan 18, 2002 8:38 pm
by Ivan Golubev
Yes, you need to list all teams even it they doesn't has a single submission.
Here is the tricks that I've found in this problem (I've already posted them in old message board):
1) Output in ranklist all teams which numbers less then or equal to largest team number in input.
2) Don't count any more runs [for this problem] if problem already accepted.
3) If rejected run and accepted run happens at the same time then count rejected run as usual (+20 min).
4) Time can be given in non-increasing order (like it shown in sample input).
Posted: Fri Jan 18, 2002 9:20 pm
by rcotta
I think the problem is with #4.
Thanks for the tips.
Posted: Sun Jan 20, 2002 7:02 am
by rcotta
I've checked for all 4 conditions, and it's ok. Does anybody have any more ideas?
Rafael
Posted: Thu Oct 31, 2002 8:11 pm
by jpfarias
Hi!
My solution is also getting WA and I've checked all 4 conditions mentioned. So, is there any other condition?
If a team has submitted, but solved no problems, it should appear before the other who did not submitted?
Do I increase the rank of teams with no submissions or they receive the same rank like the teams with same score?
Thanks!
Jo
Posted: Thu Oct 31, 2002 8:47 pm
by Ivan Golubev
jpfarias wrote:If a team has submitted, but solved no problems, it should appear before the other who did not submitted?
No.
jpfarias wrote:Do I increase the rank of teams with no submissions or they receive the same rank like the teams with same score?
They receive same score.
My sorting function looks like:[c]int tcompare(const void *op1, const void *op2)
{
TEAM *p1 = (TEAM *)op1;
TEAM *p2 = (TEAM *)op2;
if (p1->active > p2->active) return -1;
if (p1->active < p2->active) return 1;
if (p1->solved > p2->solved) return -1;
if (p1->solved < p2->solved) return 1;
if (p1->ttime < p2->ttime) return -1;
if (p1->ttime > p2->ttime) return 1;
if (p1->num < p2->num) return -1;
if (p1->num > p2->num) return 1;
return 0;
}[/c]
Also small test, input:[c]1
1 A 0:50 N
3 A 1:12 Y
2 B 1:19 N
1 A 1:20 Y
2 B 1:35 N
1 B 1:36 N
3 B 1:40 Y
3 C 1:41 N
4 A 1:40 Y
9 D 0:20 Y[/c]Output:[c]RANK TEAM PRO/SOLVED TIME
1 3 2 172
2 9 1 20
3 1 1 100
3 4 1 100
5 2
5 5
5 6
5 7
5 8[/c]
Posted: Sun Nov 03, 2002 3:44 pm
by jpfarias
Hi!
My solution give the right output for yours input.
here is my compare function:
[cpp]
int comp(const void *c1, const void *c2) {
Team *t1 = (Team *)c1;
Team *t2 = (Team *)c2;
if (t1->num_solved != t2->num_solved) {
return t2->num_solved - t1->num_solved;
}
if (t1->time != t2->time) {
return t1->time - t2->time;
}
return t1->team_num - t2->team_num;
}
[/cpp]
What's that active attribute?
Thanks, see ya!
Jo
Posted: Sun Nov 03, 2002 6:10 pm
by Ivan Golubev
Your compare function looks OK.
"Active" means that we're need to output statistics for this team (all teams from 1 to max-in-input has this attribute).
So, I have no idea what's can be wrong in your solution. If you want I can send you my source code.
Posted: Mon Nov 04, 2002 5:09 am
by jpfarias
Hi!
I've sent my code to you via Private Message!
Thanks a lot!
Jo
Posted: Mon Nov 04, 2002 6:51 pm
by Ivan Golubev
Try this input:
Code: Select all
1
2 A 8:04 N
2 A 15:59 N
2 A 18:35 N
2 A 20:29 Y
2 B 10:28 Y
2 B 17:49 Y
2 C 6:57 Y
2 C 11:06 N
2 C 13:33 Y
2 C 14:25 N
2 C 21:34 Y
2 C 22:41 N
2 C 23:01 Y
2 C 23:21 Y
2 D 1:11 Y
2 D 18:50 N
2 D 22:33 Y
2 E 16:36 Y
2 E 17:09 Y
2 E 17:49 Y
2 E 20:39 N
2 F 0:20 N
2 F 7:01 N
2 F 8:08 N
2 F 9:51 Y
2 G 6:08 Y
2 G 11:22 N
2 G 13:07 Y
2 G 14:10 Y
Your solution gives:
Code: Select all
RANK TEAM PRO/SOLVED TIME
1 2 7 4580
2 1
My solution answer is:
Code: Select all
RANK TEAM PRO/SOLVED TIME
1 2 7 4420
2 1
Posted: Mon Nov 04, 2002 9:06 pm
by jpfarias
Hi!
I've found the bug in my solution! I forget the return in my function wich inserts a wrong submisson in the list... I just don't know why I've made it to be sorted if I go on throght all the list.
Thanks a lot!
Jo
Posted: Mon May 12, 2003 6:43 am
by Observer
Ivan Golubev wrote:3) If rejected run and accepted run happens at the same time then count rejected run as usual (+20 min).
What do you mean by that?
Can you illustrate this in an example?
Btw, I wonder why none of the correct submissions for this qq is in Pascal!!!!!!!!

Posted: Tue May 13, 2003 1:54 am
by jpfarias
It means that if a wrong submission get to the judge at the same time of a accepted one, u should sum 20 min on the final time...
2 A 0:04 N
2 A 0:04 Y
Should sum to 24 min...
It's very strange...
Posted: Thu Aug 14, 2003 3:15 pm
by Sanghack
Ivan Golubev said,
1) Output in ranklist all teams which numbers less then or equal to largest team number in input.
It's very strange to me. (eventhough I did not sent my solution yet.)
It seems like error of online-judge program.
How can we know that largest team who have submitted is the largest.
(Before I read this topic, I have programmed with the team who have submitted.)
If we have to check largest team number , then why don't we have to check smallest team number.
We have to said to judge, 'please add description'
790
Posted: Mon Jun 07, 2004 5:43 pm
by sumankar
I am sorting the input log, assigning rank on the basis
of whether the team has at least 1 problem solved.
What else am I supposed to do to get AC?