10258 - Contest Scoreboard

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

Moderator: Board moderators

carpaneses
New poster
Posts: 3
Joined: Sat Jun 30, 2007 5:52 pm
Location: Sao Paulo - Brasil

Post by carpaneses » Sat Jul 07, 2007 6:41 pm

I tried to remove this extra space after the Penalty Time and i Still receiving PE.

Here are an output for 2 cases:

Code: Select all

38 1 0
69 1 11
52 1 16
7 0 0
21 0 0
27 0 0
43 0 0
48 0 0
54 0 0
55 0 0
59 0 0
61 0 0
68 0 0
83 0 0
84 0 0
89 0 0

24 1 17
32 1 17
61 1 34
77 1 36
87 1 43
3 0 0
6 0 0
7 0 0
8 0 0
21 0 0
25 0 0
29 0 0
30 0 0
35 0 0
44 0 0
46 0 0
48 0 0
57 0 0
60 0 0
72 0 0
74 0 0
75 0 0
84 0 0
85 0 0
88 0 0
96 0 0
Is it correct??

mmonish
Experienced poster
Posts: 109
Joined: Sun Mar 11, 2007 2:55 pm
Location: SUST

Post by mmonish » Sun Jul 08, 2007 1:43 am

Yes it's right. Here is my AC output format

Code: Select all

scanf("%d" , &test);
while(test--)
{
//code
for(i = 0;i<n;i++)
        printf("%d %d %d\n" , res[i].teamid , res[i].solved_prob ,res[i].penalty);
if(test)
        printf("\n");
}
Hope this helps.

hamedv
Learning poster
Posts: 98
Joined: Mon May 07, 2007 8:30 am

Post by hamedv » Thu Aug 02, 2007 7:39 pm

what's wrong with my code???

Code: Select all

#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;

struct u {
	int tot, time, num, t[10];
	bool b[10], s;
} team[121];

bool comp(u a, u b)
{
	return (a.tot > b.tot) || (a.tot == b.tot && a.time < b.time) || (a.tot == b.tot && a.time == b.time && a.num < b.num);
}

int main()
{
	int t, time, teamn, prob, i, j;
	char c[110], ans;
	cin >> t;
	cin.get();
	cin.get();
	while (t--)
	{
		for (i = 0; i < 121; i++)
		{
			team[i].tot = 0, team[i].time = 0, team[i].s = 0, team[i].num = i;
			for (j = 0; j < 10; j++)
				team[i].b[i] = 0, team[i].t[i] = 0;
		}
		while (fgets(c, 110, stdin) != NULL && *c != '\n')
		{
			sscanf(c, "%d %d %d %c", &teamn, &prob, &time, &ans);
			team[teamn].s = 1;
			if (ans == 'I')
			{
				if (!team[teamn].b[prob])
					team[teamn].t[prob]++;
			}
			if (ans == 'C')
			{
				if (!team[teamn].b[prob])
					team[teamn].time += time + team[teamn].t[prob]*20, team[teamn].b[prob] = 1, team[teamn].tot++;
			}
		}
		sort(team, team+101, comp);
		for (i = 0; i < 121; i++)
			if (team[i].s)
				cout << team[i].num << " " << team[i].tot << " " << team[i].time << endl;
		if (t) cout << endl;
	}
	return 0;
}

hamedv
Learning poster
Posts: 98
Joined: Mon May 07, 2007 8:30 am

Post by hamedv » Thu Aug 09, 2007 4:46 pm

no one to help me

carl
New poster
Posts: 1
Joined: Fri Oct 19, 2007 5:09 pm

Post by carl » Fri Oct 19, 2007 5:13 pm

i get WA

can anyone tell me where is wrong :(

Code: Select all

already AC :D 

Deafie1
New poster
Posts: 2
Joined: Sat Oct 20, 2007 9:47 am
Contact:

Contest Scoreboard - 10258

Post by Deafie1 » Sat Oct 20, 2007 10:12 am

:D
Last edited by Deafie1 on Tue Jul 08, 2008 2:38 pm, edited 2 times in total.

devious
New poster
Posts: 13
Joined: Wed Feb 22, 2006 1:26 am

Post by devious » Sat Oct 20, 2007 12:58 pm

Lol. I believe first and foremost your problem is you didn't write that code yourself. I blame myself for that though. I have removed my code from this thread.

Deafie1
New poster
Posts: 2
Joined: Sat Oct 20, 2007 9:47 am
Contact:

Mike - Devious

Post by Deafie1 » Sat Oct 20, 2007 9:44 pm

:D :) :( :o :P :x :lol: :cry: :roll:
Last edited by Deafie1 on Tue Jul 08, 2008 2:40 pm, edited 2 times in total.

rhsumon
New poster
Posts: 48
Joined: Wed Aug 23, 2006 12:29 pm
Location: Dhaka

Post by rhsumon » Thu Mar 06, 2008 10:35 pm

Hello programmers
I'm trying it for 3 hours but still wa
Where is the problem
Any one help me , Here is my code:

Code: Select all

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

int inc[105][105],cor[105][10];

struct contest{
	int solve;
	int pen;
	int team;
	int sub;
};

int cmp(const void *ia, const void *ib){

	struct contest *a = (struct contest *)ia;
    struct contest *b = (struct contest *)ib;

	if(a->solve < b->solve) return -1;
	if(a->solve > b->solve) return 1;

	if(a->pen < b->pen) return 1;
	if(a->pen > b->pen) return -1;

	if(a->team < b->team) return 1;
	if(a->team > b->team) return -1;

	return 0;
}

int main()
{
	//freopen("1.out","w",stdout);
	struct contest con[105];
	int T,i,a,b,c,x,j,max;
	char l,str[100];
	scanf("%d",&T);
	gets(str);
	for(x=0; x<T; x++){
		gets(str);
		for(i=1; i<=101; i++){
			con[i].sub=0;
			con[i].pen=0; 
			con[i].solve=0;
			for(j=1; j<=10; j++){
				inc[i][j]=0;
				cor[i][j]=0;
			}
		} 
		i=0; max=0;
		while(gets(str)!=NULL){
			if(strcmp(str,"")==0) break;
			char *p;
			p=strtok(str," ");
			a=atoi(p);
			p=strtok(NULL," ");
			b=atoi(p);
			p=strtok(NULL," ");
			c=atoi(p);
			p=strtok(NULL," ");
			l=p[0];
			con[a].team=a;
			if(l=='C' && cor[a][b]==0){
				cor[a][b]=1;
				con[a].solve++;
				if(inc[a][b]!=0)
					con[a].pen+=c+(20*inc[a][b]);
				else con[a].pen+=c;
				inc[a][b]=0;
			}
			if(l=='I' && cor[a][b]==0)
				inc[a][b]=1;
			con[a].sub++;
			if(max < a) max=a;
		}		
		qsort(con, max+1, sizeof(struct contest), cmp);
		for(i=max; i>=1; i--){
			if(con[i].sub==0) continue;
			printf("%d %d %d\n",con[i].team,con[i].solve,con[i].pen);
		}
		if(x < T-1) printf("\n");
	}
	return 0;
}

Pls reply me ... i'm worried

mfCoder
New poster
Posts: 1
Joined: Sat Dec 27, 2008 1:41 am

10258 - Contest Scoreboard

Post by mfCoder » Sat Dec 27, 2008 2:01 am

Maybe this test case will help somebody:
Input

Code: Select all

1

1 1 20 C
1 1 25 C
My AC program gives the following:

Code: Select all

1 1 20

AmitMist
New poster
Posts: 6
Joined: Wed Feb 18, 2009 10:20 pm

Subimmission count-10258

Post by AmitMist » Wed Mar 04, 2009 4:10 pm

What will be counted as a "Submission"?

Should I count "E" or "R" as submission??
:roll:

AmitMist
New poster
Posts: 6
Joined: Wed Feb 18, 2009 10:20 pm

Re: 10258 - Contest Scoreboard...plz plz plz help me guys...

Post by AmitMist » Wed Mar 04, 2009 10:09 pm

Why i am getting it WA. Actually I am confused about considering the submission. That means which will not bring the team in the ranking?? :cry:
Plz help me.........Thank u in advance

Amit

Code: Select all



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


class contest
{
	int id;
	int prob_num;
	int time;
	int total_time;
	int solved;
	char ch;
	bool status;
	bool penalty_stat;
	bool prob_stat[12];
	int count;
	bool stat;
	int c;
	

public:
	

	void init()                              
	{
		int i;
		id=0;
		prob_num=0;
		time=0;
		total_time=0;
		solved=0;
		status=false;
		count=0;
		stat=false;
		c=0;

		for(i=1;i<10;i++)
			prob_stat[i]=false;
		
	}	
	void entry(int z,int x,int y,char c);

	void time_calcu();

	int get_time();
	
	int get_solved();

	int penalty();

	void print();

	

};

void contest:: entry(int z,int x,int y,char c )
{
	id=z;
	prob_num= x;
	time=y;
	ch=c;

}

void contest:: time_calcu()
{
		if(ch=='C' )
		{
			if(prob_stat[prob_num]== false)
			{
				prob_stat[prob_num]=true;
				total_time= total_time + time + c*20;
				stat=true;

				c=0;
				solved++;
				status=true;
				penalty_stat=true;
			}
		}
		else if( ch=='I')
		{
			if(prob_stat[prob_num] == false)
			{
				if(penalty_stat==true)
				{
					//if(stat==true)
					total_time= total_time + 20;
				}
				else if(stat == false)
					c++;
			
				status=true;
			
			}
		}

		else if( ch=='R')
		{
			status= true;
			penalty_stat=false;
		}

		else if( ch=='E')
		{
			status= true;
			penalty_stat=false;
		}

		else if( ch=='U')
		{
			status= true;
			penalty_stat=false;
		}
}




int contest::get_time()
	{
		return total_time;
	}





int contest ::get_solved()
	{
		return solved;
	}



void contest::print()
{
	if(status==true)
		printf("%d %d %d\n",id,solved,total_time);
}







int main()
{
	contest s[105];
	contest tmp;
	
	char whole[50];
	int i,num,j;
	int team,prob,times;
	char st,nwe;
	int count=0;


	//freopen("in.txt","r",stdin);
	//freopen("out.txt","w",stdout);

	scanf("%d",&num);

	while(num!=0)
	{
		for(i=1;i<=100;i++)
			s[i].init();

		if(count==0)
		{
			scanf("%c%c",&nwe,&nwe);
			count=1;
		}
	
		while(gets(whole)!=NULL)
		{
			
			if(strcmp(whole,"")==0)
				break;
			
			sscanf(whole,"%d %d %d %c",&team,&prob,&times,&st);
			s[team].entry(team,prob,times,st);
			s[team].time_calcu();
		
		}

	

		for (i = 1; i < 100; i++)
			for (j = 1; j < 100; j++)
				if (s[j].get_solved() < s[j+1].get_solved())
				{
				   tmp = s[j];
				   s[j] = s[j+1];
				   s[j+1] = tmp;
				}

		


		for (i = 1; i < 100; i++)
			for (j = 1; j < 100; j++)
				if (	( s[j].get_solved()== s[j+1].get_solved() )   &&  ( s[j].get_time() > s[j+1].get_time() ) 	)
				{
				   tmp = s[j];
				   s[j] = s[j+1];
				   s[j+1] = tmp;
				}

		for (i = 1; i <= 100; i++)
			s[i].print();

	
		if(num>1)
			printf("\n");
		
		num--;

			
	}

	return 0;
}





newkid
Learning poster
Posts: 73
Joined: Fri Dec 12, 2008 3:06 am

Re: 10258 - Contest Scoreboard

Post by newkid » Mon Mar 09, 2009 7:28 pm

@AmitMist
If two contestant has same number of solution and same time penalty then they should be sorted by their id.
hmm..

newkid
Learning poster
Posts: 73
Joined: Fri Dec 12, 2008 3:06 am

Re: 10258 - Contest Scoreboard

Post by newkid » Mon Mar 09, 2009 7:40 pm

@amit
You should add the penalty only if the contestant solves the problem.
try this input

Code: Select all

1

1 2 10 I
3 1 11 C
1 2 19 R
1 2 21 C
1 1 25 C
1 3 20 I
1 4 40 I
8 4 50 I
my acc code returns

Code: Select all

1 2 66
3 1 11
8 0 0
your one returns

Code: Select all

1 2 106
3 1 11
8 0 0
hmm..

AmitMist
New poster
Posts: 6
Joined: Wed Feb 18, 2009 10:20 pm

Re: 10258 - Contest Scoreboard

Post by AmitMist » Sun Nov 29, 2009 7:59 pm

Thanks everybody specially to new kid. I have the AC :)

Post Reply

Return to “Volume 102 (10200-10299)”