Page 4 of 6
Re: 10258 - Contest Scoreboard
Posted: Tue Jan 12, 2010 3:53 am
by Ivan Goroun
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
Re: 10258 - Contest Scoreboard
Posted: Sun Nov 21, 2010 7:01 pm
by hala
Please I want the solution of the ScoreBoard in java please .... any help ?!!!!!!!!!

Re: 10258 - Contest Scoreboard
Posted: Thu Apr 07, 2011 6:40 pm
by rjjfdn
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)
v.addElement(new Contestant(id));
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!
Re: 10258 - Contest Scoreboard
Posted: Wed Jan 11, 2012 6:48 pm
by mythnc
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.
Re: 10258 - Contest Scoreboard
Posted: Mon Mar 26, 2012 8:58 pm
by Scarecrow
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

Re: 10258 - Contest Scoreboard
Posted: Thu Jun 28, 2012 3:10 pm
by magurmach
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
Re: 10258 - Contest Scoreboard
Posted: Tue Mar 05, 2013 1:42 am
by sherifibrahim44
Hi,
i always get WA
pleeeeease help,
Re: 10258 - Contest Scoreboard
Posted: Tue Mar 05, 2013 2:32 am
by lbv
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
Re: 10258 - Contest Scoreboard
Posted: Tue Mar 05, 2013 2:39 am
by sherifibrahim44
Thanks for your reply,
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

Re: 10258 - Contest Scoreboard
Posted: Tue Mar 05, 2013 2:57 am
by lbv
sherifibrahim44 wrote:Thanks for your reply,
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).
Re: 10258 - Contest Scoreboard
Posted: Tue Mar 05, 2013 3:15 am
by sherifibrahim44
i removed it, i still got WA,
i'm sure the first line of my output is
what else can cause a problem,
i'm really grateful to you for your replies i really need the help

Re: 10258 - Contest Scoreboard
Posted: Tue Mar 05, 2013 10:23 pm
by brianfry713
See:
https://ideone.com/Smd2de
Post your updated code without the output file if you still need help.
10258- Contest Scoreboard
Posted: Tue Jun 25, 2013 11:13 pm
by lukai
Why WA I can't understand. Can someone give me some critical I/O
Code: Select all
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdlib>
#include <ctime>
#include <vector>
#include <list>
#include <deque>
#include <queue>
#include <stack>
#include <map>
#include <set>
#include <bitset>
#include <cctype>
#include <cstring>
#include <typeinfo>
#include <exception>
#include <stdexcept>
#include <memory>
#include <fstream>
#include <string>
#include <sstream>
#include <functional>
#include <iterator>
#include <algorithm>
#include <cassert>
#include <cfloat>
#include <climits>
#include <cstdio>
#include <locale>
#include <limits>
#include <utility>
using namespace std;
typedef struct{
int user_id;
int solved;
int penalty;
}team;
bool compare(team a,team b)
{
if(a.solved!=b.solved)
{
return (a.solved>b.solved);
}
else if(a.penalty!=b.penalty)
{
return (a.penalty<b.penalty);
}
else if(a.user_id!=b.user_id)
{
return (a.user_id<b.user_id);
}
}
int main()
{
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
int contestant,problem_id,time,i,j,solution,total_time;
char submission;
int cases;
int check_problem[110][11];
int check_time[110][11];
cin>>cases;
while(cases--)
{
getchar();
memset(check_problem,0,sizeof(check_problem));
memset(check_time,0,sizeof(check_time));
while(cin>>contestant>>problem_id>>time>>submission)
{
check_problem[contestant][0]=1;
if(check_problem[contestant][problem_id]==0)
{
if(submission=='C')
{
check_time[contestant][problem_id]*=20;
check_time[contestant][problem_id]+=time;
check_problem[contestant][problem_id]=1;
}
if(submission=='I')
{
check_time[contestant][problem_id]++;
}
}
}
vector<team>company;
team temp;
for(i=1;i<102;i++)
{
solution=0;
total_time=0;
if(check_problem[i][0]==1)
{
for(j=1;j<10;j++)
{
if(check_problem[i][j]==1)
{
solution++;
total_time+=check_time[i][j];
}
}
temp.user_id=i;
temp.solved=solution;
temp.penalty=total_time;
company.push_back(temp);
}
}
sort(company.begin(),company.end(),compare);
for(i=0;i<company.size();i++)
{
temp=company[i];
cout<<temp.user_id<<" "<<temp.solved<<" "<<temp.penalty<<endl;
}
company.clear();
if(cases)
{
cout<<endl;
}
}
return 0;
}
Re: 10258- Contest Scoreboard
Posted: Tue Jun 25, 2013 11:30 pm
by @li_kuet
your code isn't working well
when there is a blank line it indicates that a test case is finished ...
your code don't do that...
try to use gets(*) or getline(cin,*)
Re: 10258 - Contest Scoreboard
Posted: Tue Aug 06, 2013 8:39 pm
by Yusif
I'm getting wa while my code works well for all the cases I saw in this thread.
Help pls! I'm frustrated!!