790 - Head Judge Headache

All about problems in Volume 7. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

rcotta
New poster
Posts: 6
Joined: Fri Jan 18, 2002 2:00 am
Location: Brazil

790 - Head Judge Headache

Post by rcotta » Fri Jan 18, 2002 7:46 pm

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

Ivan Golubev
Experienced poster
Posts: 167
Joined: Fri Oct 19, 2001 2:00 am
Location: Saint Petersburg, Russia

Post by Ivan Golubev » Fri Jan 18, 2002 8:38 pm

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).

rcotta
New poster
Posts: 6
Joined: Fri Jan 18, 2002 2:00 am
Location: Brazil

Post by rcotta » Fri Jan 18, 2002 9:20 pm

I think the problem is with #4.
Thanks for the tips.

rcotta
New poster
Posts: 6
Joined: Fri Jan 18, 2002 2:00 am
Location: Brazil

Post by rcotta » Sun Jan 20, 2002 7:02 am

I've checked for all 4 conditions, and it's ok. Does anybody have any more ideas?

Rafael

jpfarias
Learning poster
Posts: 98
Joined: Thu Nov 01, 2001 2:00 am
Location: Brazil
Contact:

Post by jpfarias » Thu Oct 31, 2002 8:11 pm

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

Ivan Golubev
Experienced poster
Posts: 167
Joined: Fri Oct 19, 2001 2:00 am
Location: Saint Petersburg, Russia

Post by Ivan Golubev » Thu Oct 31, 2002 8:47 pm

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]

jpfarias
Learning poster
Posts: 98
Joined: Thu Nov 01, 2001 2:00 am
Location: Brazil
Contact:

Post by jpfarias » Sun Nov 03, 2002 3:44 pm

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

Ivan Golubev
Experienced poster
Posts: 167
Joined: Fri Oct 19, 2001 2:00 am
Location: Saint Petersburg, Russia

Post by Ivan Golubev » Sun Nov 03, 2002 6:10 pm

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.

jpfarias
Learning poster
Posts: 98
Joined: Thu Nov 01, 2001 2:00 am
Location: Brazil
Contact:

Post by jpfarias » Mon Nov 04, 2002 5:09 am

Hi!

I've sent my code to you via Private Message!

Thanks a lot!
Jo

Ivan Golubev
Experienced poster
Posts: 167
Joined: Fri Oct 19, 2001 2:00 am
Location: Saint Petersburg, Russia

Post by Ivan Golubev » Mon Nov 04, 2002 6:51 pm

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

jpfarias
Learning poster
Posts: 98
Joined: Thu Nov 01, 2001 2:00 am
Location: Brazil
Contact:

Post by jpfarias » Mon Nov 04, 2002 9:06 pm

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

Observer
Guru
Posts: 570
Joined: Sat May 10, 2003 4:20 am
Location: Hong Kong

Post by Observer » Mon May 12, 2003 6:43 am

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!!!!!!!! :( :( :(
7th Contest of Newbies
Date: December 31st, 2011 (Saturday)
Time: 12:00 - 16:00 (UTC)
URL: http://uva.onlinejudge.org

jpfarias
Learning poster
Posts: 98
Joined: Thu Nov 01, 2001 2:00 am
Location: Brazil
Contact:

Post by jpfarias » Tue May 13, 2003 1:54 am

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...

Sanghack
New poster
Posts: 16
Joined: Wed Jul 17, 2002 5:55 pm
Location: Seoul, Korea

It's very strange...

Post by Sanghack » Thu Aug 14, 2003 3:15 pm

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'
A farmer learns more from a bad harvest than a good one.

sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

790

Post by sumankar » Mon Jun 07, 2004 5:43 pm

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?

Post Reply

Return to “Volume 7 (700-799)”