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

flavio
New poster
Posts: 11
Joined: Sun Mar 06, 2005 4:07 pm
Location: Porto Alegre - RS (Brazil)
Contact:

Post by flavio »

Ryan Pai said:

"Assume that every team with a number between 1 and T exists, where T is the largest team number in the input case.

If a team has multiple submissions at the same contest time, consider all off the Y's to happen after the N's."

---------------

These are the hints!!!
I've got accepted!
\o/
Fl
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

Actually I thought if there are several submissions at the same time, then the one that occurs first is considered first. But after that I found that for this case we should consider all the submissions (occuring at the same time). But I still think that the problem description should be updated.
Ami ekhono shopno dekhi...
HomePage
hyperion
New poster
Posts: 8
Joined: Sun Aug 07, 2005 2:21 pm

Post by hyperion »

Hi !
I've done all of the hints above in my code
but i'm still getting WA :( ,
can anyone help me with some test cases,
thank further.....
penpen
New poster
Posts: 1
Joined: Sun Sep 11, 2005 11:38 pm
Location: Mexico

790 Some input test please=

Post by penpen »


Hi I did this problem but the server alway return wa, I've read the other coments, and i've done it but it still is wa.

Has some body any critical test case.? :o
Thanx
No matter what was the result the most important is to learn to do it better.
CodeMaker
Experienced poster
Posts: 183
Joined: Thu Nov 11, 2004 12:35 pm
Location: AIUB, Bangladesh

Post by CodeMaker »

Hi, i am also getting WA. i have checked the other posts and have checked my code with the tricky cases but still no luck.

i can't find any bug in my code, neither i can get any wrong output for my test cases. but what i m missing might be seen by others. so here is the test cases and the output my code produced for those. any help will be a great help here. thanks

Code: Select all

13

1 A 0:90 N
22 B 5:00 Y
22 A 2:00 N
5 G 2:34 Y
4 B 4:00 N
3 C 1:00 Y
9 F 3:03 N
2 C 2:01 Y
6 D 0:20 Y
14 B 0:12 N
13 A 2:22 N
5 A 0:25 Y
1 C 2:11 Y
6 C 2:11 N
8 B 3:00 N
5 E 0:24 Y
10 A 2:44 Y
11 A 2:45 Y
9 A 2:43 Y
8 F 2:34 Y
17 D 2:00 Y
7 G 3:00 Y
3 E 4:00 Y
4 A 3:00 N
7 B 2:00 Y

1 F 5:00 N
2 A 4:00 Y
6 C 1:00 N
2 C 4:00 Y
9 E 3:44 N
16 G 1:01 Y
8 B 0:45 N
3 A 0:30 Y

1 A 0:00 Y
1 A 0:10 N
1 A 0:00 Y

25 G 9:99 N

25 G 9:00 Y

1 A 0:00 N
1 B 0:00 Y

1 A 0:10 Y
25 A 0:10 Y

3 A 0:00 Y
3 G 0:00 Y
4 A 0:00 Y
4 G 0:00 Y
1 A 0:00 Y
1 G 0:00 Y
2 A 0:00 Y
2 G 0:00 Y
25 A 0:00 Y
25 G 0:00 Y

4 C 1:00 N
5 D 1:00 N
4 D 1:00 Y
5 C 1:00 Y
4 D 1:10 N
5 C 1:10 N
4 C 2:00 Y
5 D 2:00 Y

1 A 1:00 N
2 A 2:00 Y
3 C 2:00 N
2 A 1:59 N
2 A 2:00 N
2 A 2:01 N

1 A 2:33 Y
2 B 2:33 Y
1 A 2:33 N
2 A 2:33 N

1 A 2:33 Y
2 A 2:33 Y
1 A 2:33 N
2 A 2:32 N

23 A 0:00 Y
23 A 0:10 N
23 B 0:10 Y
23 B 0:30 N
23 C 0:30 Y
23 C 0:50 N
23 D 0:50 Y
23 D 1:00 N
23 E 1:00 Y
23 E 1:10 N
23 F 1:10 Y
23 F 5:00 N
23 G 5:00 Y
23 G 5:01 N
the output from my WA code:

Code: Select all

RANK TEAM PRO/SOLVED TIME
   1    5    3        203
   2    3    2        300
   2    7    2        300
   3    6    1         20
   4   17    1        120
   5    2    1        121
   6    1    1        131
   7    8    1        154
   8    9    1        163
   9   10    1        164
  10   11    1        165
  11   22    1        300
  12    4
  12   12
  12   13
  12   14
  12   15
  12   16
  12   18
  12   19
  12   20
  12   21

RANK TEAM PRO/SOLVED TIME
   1    2    2        480
   2    3    1         30
   3   16    1         61
   4    1
   4    4
   4    5
   4    6
   4    7
   4    8
   4    9
   4   10
   4   11
   4   12
   4   13
   4   14
   4   15

RANK TEAM PRO/SOLVED TIME
   1    1    1          0

RANK TEAM PRO/SOLVED TIME
   1    1
   1    2
   1    3
   1    4
   1    5
   1    6
   1    7
   1    8
   1    9
   1   10
   1   11
   1   12
   1   13
   1   14
   1   15
   1   16
   1   17
   1   18
   1   19
   1   20
   1   21
   1   22
   1   23
   1   24
   1   25

RANK TEAM PRO/SOLVED TIME
   1   25    1        540
   2    1
   2    2
   2    3
   2    4
   2    5
   2    6
   2    7
   2    8
   2    9
   2   10
   2   11
   2   12
   2   13
   2   14
   2   15
   2   16
   2   17
   2   18
   2   19
   2   20
   2   21
   2   22
   2   23
   2   24

RANK TEAM PRO/SOLVED TIME
   1    1    1          0

RANK TEAM PRO/SOLVED TIME
   1    1    1         10
   1   25    1         10
   2    2
   2    3
   2    4
   2    5
   2    6
   2    7
   2    8
   2    9
   2   10
   2   11
   2   12
   2   13
   2   14
   2   15
   2   16
   2   17
   2   18
   2   19
   2   20
   2   21
   2   22
   2   23
   2   24

RANK TEAM PRO/SOLVED TIME
   1    1    2          0
   1    2    2          0
   1    3    2          0
   1    4    2          0
   1   25    2          0
   2    5
   2    6
   2    7
   2    8
   2    9
   2   10
   2   11
   2   12
   2   13
   2   14
   2   15
   2   16
   2   17
   2   18
   2   19
   2   20
   2   21
   2   22
   2   23
   2   24

RANK TEAM PRO/SOLVED TIME
   1    4    2        200
   1    5    2        200
   2    1
   2    2
   2    3

RANK TEAM PRO/SOLVED TIME
   1    2    1        160
   2    1
   2    3

RANK TEAM PRO/SOLVED TIME
   1    2    1        153
   2    1    1        173

RANK TEAM PRO/SOLVED TIME
   1    1    1        173
   1    2    1        173

RANK TEAM PRO/SOLVED TIME
   1   23    7        520
   2    1
   2    2
   2    3
   2    4
   2    5
   2    6
   2    7
   2    8
   2    9
   2   10
   2   11
   2   12
   2   13
   2   14
   2   15
   2   16
   2   17
   2   18
   2   19
   2   20
   2   21
   2   22
My approach is :
1) sort the submission list according to increasing submission time, in case of tie rejected submission comes first
2) now with the sorted list, check if the i'th submission:
if this submission for problem x by team y, iff not accepted already then
if accepted then increase number of solve for that team and add penalty otherwise increase rejected submission for that problem for that team.
3) sort the teams according to number of solve, in case of tie according to number of penalty, in case of tie according to team number
4) all teams having same solve and same penalty has same place otherwise their respective place

i think there is only single blank line between the case number and datasets. i assume there is no invalid input. i assume a line will have atbest 999 characters

what else?!
Jalal : AIUB SPARKS
sobhan naderi
New poster
Posts: 7
Joined: Sat Sep 02, 2006 8:59 am
Location: Sweden/Stockholm
Contact:

the output for your input

Post by sobhan naderi »

Hello dear friend. this is my PE code output for the above input.

Code: Select all

RANK TEAM PRO/SOLVED TIME
   1    5    3        203
   2    3    2        300
   2    7    2        300
   4    6    1         20
   5   17    1        120
   6    2    1        121
   7    1    1        131
   8    8    1        154
   9    9    1        163
  10   10    1        164
  11   11    1        165
  12   22    1        300
  13    4                
  13   12                
  13   13                
  13   14                
  13   15                
  13   16                
  13   18                
  13   19                
  13   20                
  13   21                

RANK TEAM PRO/SOLVED TIME
   1    2    2        480
   2    3    1         30
   3   16    1         61
   4    1                
   4    4                
   4    5                
   4    6                
   4    7                
   4    8                
   4    9                
   4   10                
   4   11                
   4   12                
   4   13                
   4   14                
   4   15                

RANK TEAM PRO/SOLVED TIME
   1    1    1          0

RANK TEAM PRO/SOLVED TIME
   1    1                
   1    2                
   1    3                
   1    4                
   1    5                
   1    6                
   1    7                
   1    8                
   1    9                
   1   10                
   1   11                
   1   12                
   1   13                
   1   14                
   1   15                
   1   16                
   1   17                
   1   18                
   1   19                
   1   20                
   1   21                
   1   22                
   1   23                
   1   24                
   1   25                

RANK TEAM PRO/SOLVED TIME
   1   25    1        540
   2    1                
   2    2                
   2    3                
   2    4                
   2    5                
   2    6                
   2    7                
   2    8                
   2    9                
   2   10                
   2   11                
   2   12                
   2   13                
   2   14                
   2   15                
   2   16                
   2   17                
   2   18                
   2   19                
   2   20                
   2   21                
   2   22                
   2   23                
   2   24                

RANK TEAM PRO/SOLVED TIME
   1    1    1          0

RANK TEAM PRO/SOLVED TIME
   1    1    1         10
   1   25    1         10
   3    2                
   3    3                
   3    4                
   3    5                
   3    6                
   3    7                
   3    8                
   3    9                
   3   10                
   3   11                
   3   12                
   3   13                
   3   14                
   3   15                
   3   16                
   3   17                
   3   18                
   3   19                
   3   20                
   3   21                
   3   22                
   3   23                
   3   24                

RANK TEAM PRO/SOLVED TIME
   1    1    2          0
   1    2    2          0
   1    3    2          0
   1    4    2          0
   1   25    2          0
   6    5                
   6    6                
   6    7                
   6    8                
   6    9                
   6   10                
   6   11                
   6   12                
   6   13                
   6   14                
   6   15                
   6   16                
   6   17                
   6   18                
   6   19                
   6   20                
   6   21                
   6   22                
   6   23                
   6   24                

RANK TEAM PRO/SOLVED TIME
   1    4    2        200
   1    5    2        200
   3    1                
   3    2                
   3    3                

RANK TEAM PRO/SOLVED TIME
   1    2    1        160
   2    1                
   2    3                

RANK TEAM PRO/SOLVED TIME
   1    2    1        153
   2    1    1        173

RANK TEAM PRO/SOLVED TIME
   1    1    1        173
   1    2    1        173

RANK TEAM PRO/SOLVED TIME
   1   23    7        520
   2    1                
   2    2                
   2    3                
   2    4                
   2    5                
   2    6                
   2    7                
   2    8                
   2    9                
   2   10                
   2   11                
   2   12                
   2   13                
   2   14                
   2   15                
   2   16                
   2   17                
   2   18                
   2   19                
   2   20                
   2   21                
   2   22                
Sobhan Naderi Parizi
sakhassan
Experienced poster
Posts: 105
Joined: Sat Mar 11, 2006 9:42 am
Location: cse,DU

Post by sakhassan »

I am getting CE !!!!!!!!!! I dont know what's the problem... I am using TC...

Code: Select all


#include<stdio.h>
#include<string.h>
#include<stdlib.h>

#define N 200
#define M 30



struct  t
{
	int t;
	int solved[N];
	int time;
	int flag;
	int tried[N];
	int done;

}team[M];



int cmp( const struct t *a, const struct t *b)
{

	 if( a->done != b->done) return (b->done - a->done);
	 if( a->time != b->time) return (a->time - b->time);
	 if( a->flag != b->flag )return (b->flag - a->flag);

	 return (a->t - b->t);
}

int main()
{


   char str[N];
   int cases;
   int i,j;
   int team_no;
   int h,m;
   char name[N],solved[N];
   int rank;
   int count;



   //freopen("790.cpp","r",stdin);
   //freopen("out.cpp","w",stdout);

   scanf("%d",&cases);
   gets(str);
   gets(str);

   while(cases--)
   {

       for(i=0;i<M;i++)
       {
	     team[i].t = -1;
	     team[i].time = 0;
	     team[i].flag = 0;
	     team[i].done = 0;
	     //team[i].tried = 0;
	     memset(team[i].solved,0,sizeof(team[i].solved));
	     memset(team[i].tried,0,sizeof(team[i].tried));
       }
       count = 0;

       while(gets(str))
       {


	  if(strlen(str)==0)
	   break;


	  sscanf(str,"%d %s %d:%d %s",&team_no,name,&h,&m,solved);


	  if(count<team_no)
	   count=team_no;


	  if(!team[team_no].solved[name[0]])
	  {

	    if(solved[0]=='Y')
	    {
	     team[team_no].time += (h*60+m) + (team[team_no].tried[name[0]]*20);
	     team[team_no].solved[name[0]]=1;
	     team[team_no].done++;

	    }
	    else
	     team[team_no].tried[name[0]]++;

	  }
	  team[team_no].flag=1;
	  team[team_no].t=team_no;
       }

       for(i=0;i<=count;i++)
       {
	team[i].t=i;
	team[i].flag=1;
       }

       qsort(team,M,sizeof(team[0]),(int(*)(const void *,const void *))cmp);
       rank = 1;
       j = 1;

       printf("RANK TEAM PRO/SOLVED TIME\n");

       for(i=1;i<=count;i++)
       {
	 if(team[i].flag)
	 {

		if( (team[i].done==team[i-1].done) &&
		    (team[i].time==team[i-1].time) && (i-1)>=0)
		{
		   rank = rank;
		}
		else
		 rank = j;




		if(team[i].done)
		  printf("%4d %4d %4d %10d\n",rank,team[i].t,team[i].done,team[i].time);
		else
		  printf("%4d %4d\n",rank,team[i].t);


		j++;

	 }
       }

       if(cases)printf("\n");

   }


   return 0;
}



Time that gone is gone forever ...
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

sakhassan wrote:I am getting CE !!!!!!!!!! I dont know what's the problem... I am using TC...

Code: Select all

...
struct  t
{
	int t;
   ...
}team[M];
...
You can't use same name for both a structure and its element. Use different name.

Hope it helps.
Ami ekhono shopno dekhi...
HomePage
sakhassan
Experienced poster
Posts: 105
Joined: Sat Mar 11, 2006 9:42 am
Location: cse,DU

Post by sakhassan »

Can anyone give me the output for this input?

Code: Select all

3

1 A 2:33 Y 
2 B 2:33 Y 
1 A 2:33 N 
2 A 2:33 N 

1 A 2:33 Y 
2 A 2:33 Y 
1 A 2:33 N 
2 A 2:32 N 

1 A 2:33 N
1 A 2:33 Y
1 A 2:44 Y


Thanks in Advance
Time that gone is gone forever ...
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Post by Jan »

My accepted code returns

Output:

Code: Select all

RANK TEAM PRO/SOLVED TIME
   1    2    1        153
   2    1    1        173

RANK TEAM PRO/SOLVED TIME
   1    1    1        173
   1    2    1        173

RANK TEAM PRO/SOLVED TIME
   1    1    1        173
Hope it helps.
Ami ekhono shopno dekhi...
HomePage
@li_kuet
New poster
Posts: 44
Joined: Fri May 25, 2012 6:22 pm
Location: Chittagong, Bangladesh

Re: 790 - Head Judge Headache

Post by @li_kuet »

Try this Input:

Code: Select all

1

25 G 9:99 N

Output should be:

Code: Select all

RANK TEAM PRO/SOLVED TIME
   1    1
   1    2
   1    3
   1    4
   1    5
   1    6
   1    7
   1    8
   1    9
   1   10
   1   11
   1   12
   1   13
   1   14
   1   15
   1   16
   1   17
   1   18
   1   19
   1   20
   1   21
   1   22
   1   23
   1   24
   1   25
Hope this will help :)
luthaz
New poster
Posts: 1
Joined: Thu Oct 02, 2014 10:06 pm

Re: 790 - Head Judge Headache

Post by luthaz »

tnx brianfry713, accepted :) and 1st time in top 10 :D
Zyaad Jaunnoo
Experienced poster
Posts: 122
Joined: Tue Apr 16, 2002 10:07 am

Incorrect input format in problem description

Post by Zyaad Jaunnoo »

The problem link http://uva.onlinejudge.org/external/7/p790.pdf does not describe the correct input format :(

Can anybody fix it please?

PS: Thanks to the board members for specifying the correct input format.
BlackBeard
New poster
Posts: 18
Joined: Wed Dec 17, 2014 9:44 pm

Re: 790 - Head Judge Headache

Post by BlackBeard »

My code is giving correct output for every input I try. But still it's giving WA...

Code: Select all

Got Ac
Last edited by BlackBeard on Sat Feb 14, 2015 2:12 am, edited 1 time in total.
BlackBeard
New poster
Posts: 18
Joined: Wed Dec 17, 2014 9:44 pm

Re: 790 - Head Judge Headache

Post by BlackBeard »

sorry for double posting... :(
Last edited by BlackBeard on Fri Feb 13, 2015 5:10 pm, edited 1 time in total.
Post Reply

Return to “Volume 7 (700-799)”