Page 3 of 4

Posted: Sat Aug 06, 2005 5:43 am
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/

Posted: Sat Aug 06, 2005 9:26 am
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.

Posted: Sun Aug 14, 2005 3:20 pm
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.....

790 Some input test please=

Posted: Sun Sep 11, 2005 11:53 pm
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

Posted: Sat Aug 05, 2006 5:31 am
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?!

the output for your input

Posted: Sun Sep 03, 2006 7:57 pm
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                

Posted: Thu Jan 11, 2007 1:39 pm
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;
}




Posted: Thu Jan 11, 2007 5:15 pm
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.

Posted: Fri Jan 12, 2007 3:00 pm
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

Posted: Fri Jan 12, 2007 9:12 pm
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.

Re: 790 - Head Judge Headache

Posted: Sun Jul 21, 2013 3:51 pm
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 :)

Re: 790 - Head Judge Headache

Posted: Thu Oct 02, 2014 10:19 pm
by luthaz
tnx brianfry713, accepted :) and 1st time in top 10 :D

Incorrect input format in problem description

Posted: Tue Dec 23, 2014 4:35 pm
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.

Re: 790 - Head Judge Headache

Posted: Thu Feb 12, 2015 7:03 am
by BlackBeard
My code is giving correct output for every input I try. But still it's giving WA...

Code: Select all

Got Ac

Re: 790 - Head Judge Headache

Posted: Thu Feb 12, 2015 7:04 am
by BlackBeard
sorry for double posting... :(