10258 - Contest Scoreboard

Moderator: Board moderators

Re: 10258 - Contest Scoreboard

Having solved this, I'd like to contribute the aggregated input and output from this thread, with a bit of my own additions (boundary cases).

Input:
Code: Select all
4

1 2 10 I
3 1 11 C
1 2 19 R
1 2 21 C
1 1 25 C

1 1 5 C
1 2 10 C
1 3 15 C
100 1 0 I
100 1 5 C
100 3 50 C
38 1 0 C
48 1 1 R
83 1 2 E
89 9 3 R
7 5 4 R
68 1 5 U
61 1 6 U
27 1 7 R
21 7 8 R
55 2 9 I
54 1 10 U
69 1 11 C
59 2 12 I
43 3 13 I
7 9 14 R
84 6 15 R
52 8 16 C
32 7 17 C
87 7 18 U
44 1 19 I
87 6 20 I
21 6 21 U
6 4 22 E
44 8 23 I
72 5 24 R
35 1 25 E
57 4 26 E
24 5 27 C
30 3 28 I
85 9 29 I
72 5 30 U
30 7 31 U
8 5 32 R
88 1 33 I
61 2 34 C
35 6 35 R
77 4 36 C
46 8 37 I
21 9 38 E
74 3 39 R
7 4 40 U
25 4 41 R
48 1 42 I
87 1 43 C
84 3 44 U
96 9 45 U
60 5 46 R
75 2 47 I
29 4 48 E
3 7 49 I

3 1 11 C
3 1 17 I

1 2 10 I
3 1 10 I
1 2 11 C
3 1 11 C
1 4 20 I

Output:
Code: Select all
1 2 66
3 1 11

1 3 30
100 2 75
38 1 0
69 1 11
52 1 16
32 1 17
24 1 27
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
27 0 0
29 0 0
30 0 0
35 0 0
43 0 0
44 0 0
46 0 0
48 0 0
54 0 0
55 0 0
57 0 0
59 0 0
60 0 0
68 0 0
72 0 0
74 0 0
75 0 0
83 0 0
84 0 0
85 0 0
88 0 0
89 0 0
96 0 0

3 1 11

1 1 31
3 1 31
Ivan Goroun
New poster

Posts: 10
Joined: Sun Dec 20, 2009 12:01 am

Re: 10258 - Contest Scoreboard

Please I want the solution of the ScoreBoard in java please .... any help ?!!!!!!!!!
hala
New poster

Posts: 1
Joined: Sun Nov 21, 2010 6:57 pm

Re: 10258 - Contest Scoreboard

Guys, please help me here. I always get RE but I don't know why. I tried all the sample inputs here, and all of them are correct. But when I send my code to UVa, they always give me an RE.T___T please help guys, need it badly.

By the way, here is my code:
Code: Select all
import java.util.*;

public class Main {

public static void main(String[] args) {
Scanner s = new Scanner(System.in);
Vector<Contestant> v;
int n = s.nextInt(), id, prob, time;
char stat;
StringTokenizer st;
String line;
s.nextLine();
s.nextLine();
for(int i=0; i<n; i++) {
v = new Vector<Contestant>();
while(true) {
line = s.nextLine();
if(line.equals(""))
break;
st = new StringTokenizer(line);
id = Integer.parseInt(st.nextToken());
if(indexOf(v, id) == -1)
prob = Integer.parseInt(st.nextToken()) - 1;
time = Integer.parseInt(st.nextToken());
stat = st.nextToken().charAt(0);
switch(stat) {
case 'C':
if(!v.elementAt(indexOf(v, id)).isSolved(prob))
v.elementAt(indexOf(v, id)).correct(prob, time);
break;
case 'I':
v.elementAt(indexOf(v, id)).wrong(prob);
break;
default:
break;
}
}
if(i != 0) System.out.println();
sort(v);
}
}

public static int indexOf(Vector<Contestant> v, int id) {
for(int i=0; i<v.size(); i++) {
if(v.elementAt(i).id == id)
return i;
}
return -1;
}

public static void sort(Vector<Contestant> v) {
for(int i=0; i<v.size(); i++) {
for(int j=i+1; j<v.size(); j++) {
if(v.elementAt(i).id > v.elementAt(j).id) {
Contestant temp = v.elementAt(i);
v.setElementAt(v.elementAt(j), i);
v.setElementAt(temp, j);
}
}
}
for(int i=1; i<v.size(); i++) {
int j = i;
Contestant temp = v.elementAt(i);
while((j>0) && (v.elementAt(j-1).compareTo(temp)<0)) {
v.setElementAt(v.elementAt(j-1), j);
j--;
}
v.setElementAt(temp, j);
}
for(int j=0; j<v.size(); j++)
System.out.println(v.elementAt(j));
}

}

class Contestant {
int id, solved, time;
boolean[] problems;
int[] incorrect;

public Contestant(int i) {
id = i;
solved = 0;
time = 0;
problems = new boolean[9];
incorrect = new int[9];
}

public void wrong(int p) {
incorrect[p]++;
}

public void correct(int p, int t) {
solved++;
problems[p] = true;
time+=t+(20*incorrect[p]);
}

public boolean isSolved(int p) {
return problems[p];
}

public int compareTo(Contestant c) {
if(solved != c.solved) {
return solved - c.solved;
}
else
return c.time - time;
}

public String toString() {
return id + " " + solved + " " + time;
}
}

Thanks guys!
rjjfdn
New poster

Posts: 1
Joined: Thu Apr 07, 2011 6:35 pm

Re: 10258 - Contest Scoreboard

This is not a accurately problem.
It is said that "problems 1 through 9."
But it's not!!
The problems is from 1 through 13.
So stupid.
I can't get AC when i set my array size to 9.
When i set it to above 13 i got AC finally.
I can't bear some uva testing datum are not as equal as it says in question statment!

And in this question, After the problem submission is AC,
don't do anything about it, regard of it is AC(C) again or WA(I).
You don't have to modify penalty time or anything else.
just tag the probem is AC or not.
mythnc
New poster

Posts: 2
Joined: Wed Jan 11, 2012 6:37 pm

Re: 10258 - Contest Scoreboard

mythnc is very much right. this problem has a wrong description i got REs for hours considering there'll be no more than 9 problems. at last checking the forum, i learnt that the problems may be more than 9. then changed the array size to 15 and got AC immediately. this type of wrong described problems should be corrected or it'll waste hours of the fellow coders and frustrate a lot
Do or do not. There is no try.
Scarecrow
Learning poster

Posts: 69
Joined: Wed Oct 19, 2011 9:06 pm

Re: 10258 - Contest Scoreboard

One Extra test case:

Code: Select all
1

1 2 10 I
3 1 11 C
3 1 25 C
1 2 19 R
1 2 21 C
1 1 25 C

Code: Select all
1 2 66
3 1 11
magurmach
New poster

Posts: 25
Joined: Mon May 14, 2012 8:19 pm

Re: 10258 - Contest Scoreboard

Hi,

i always get WA

pleeeeease help,

Code: Select all
Solved
Last edited by sherifibrahim44 on Tue Mar 12, 2013 3:31 am, edited 1 time in total.
sherifibrahim44
New poster

Posts: 4
Joined: Thu Feb 21, 2013 11:29 pm

Re: 10258 - Contest Scoreboard

sherifibrahim44 wrote:Hi,

i always get WA

You may try the following cases:

Input
Code: Select all
3

1 3 140 I

6 8 17 I
1 5 24 C
6 5 26 I
4 8 83 C
6 5 106 C
5 6 118 R
1 4 121 C
7 2 131 I
3 6 153 I
10 7 158 U
4 7 234 I
9 9 294 I

1 1 12 I
2 3 61 C
1 2 105 E
2 1 134 R
2 1 160 C
1 2 171 R
1 2 210 E
2 3 223 I

Output
Code: Select all
1 0 0

1 2 145
4 1 83
6 1 126
3 0 0
5 0 0
7 0 0
9 0 0
10 0 0

2 2 221
1 0 0
lbv
Learning poster

Posts: 54
Joined: Tue Nov 29, 2011 8:40 am

Re: 10258 - Contest Scoreboard

my program output is the same as the expected output,

i still got WA, any suggestions
i'm newbie, and worked for it for days, i feel disappointing
sherifibrahim44
New poster

Posts: 4
Joined: Thu Feb 21, 2013 11:29 pm

Re: 10258 - Contest Scoreboard

my program output is the same as the expected output,

I tried the code you posted in your first message, and the answer I see is:
Code: Select all
0 0 0

1 2 145
4 1 83
6 1 126
0 0 0
3 0 0
5 0 0
7 0 0
9 0 0

2 2 221
6 1 126

Are you testing the same code you posted?

I also see that your program creates a file called Testing.txt. I thought you just forgot to remove the file operations when copying your code for the forums, but if you leave that code in your real submission, the judge will consider your program "wrong" (for more details, see here).
lbv
Learning poster

Posts: 54
Joined: Tue Nov 29, 2011 8:40 am

Re: 10258 - Contest Scoreboard

i removed it, i still got WA,
i'm sure the first line of my output is

Code: Select all
1 0 0

what else can cause a problem,
i'm really grateful to you for your replies i really need the help
sherifibrahim44
New poster

Posts: 4
Joined: Thu Feb 21, 2013 11:29 pm

Re: 10258 - Contest Scoreboard

See:
https://ideone.com/Smd2de

Post your updated code without the output file if you still need help.
brianfry713
Guru

Posts: 1742
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Previous