Page 2 of 2
10698 - Football Sort
Posted: Mon May 02, 2005 12:04 pm
by Zyaad Jaunnoo
Hi Guyz...
I keep getting WA about this problem (although it sounds to be one of those straight forward problem). Is there some tricky test cases about this problem? If yes please post some along with their output. Thanks!

Posted: Mon May 02, 2005 1:58 pm
by Eduard
Hello.
I think the best special test is the sample input.
Please read the old post about this problem.
http://online-judge.uva.es/board/viewto ... tball+sort
Eduard
Posted: Mon May 02, 2005 2:11 pm
by Zyaad Jaunnoo
Thanks Eduard
My program passes the sample input though...

Posted: Thu May 26, 2005 6:46 pm
by Larry
Posted: Sat Dec 17, 2005 8:46 pm
by mf
Could someone clarify what is meant by "percentage of earned points" in this problem (#10698)?
It's ratio of team's earned points to what?
Posted: Sun Dec 18, 2005 1:26 am
by mf
Nevermind, I've figured it out. It's ratio to 3 times the number of team's played games. What a poorly-written problem!
Check With this I/O
Posted: Sun Feb 25, 2007 3:24 am
by Mushfiqur Rahman
I got 4 times WA in this problem. Lastly I found my bug. I generate this Input and got the bug. May be it would be helpful for u.
Input:
Output:
Code: Select all
1. a 0 0 0 0 0 N/A
B 0 0 0 0 0 N/A
Re: contest 2004-8-7 problem C - Football Sort
Posted: Wed Jul 20, 2011 10:18 pm
by plamplam
The problem-setter is a couch potato, very dull and anooying problem description. I had a hard time counting all the spaces and shit...got PE twice before Accepted.
Code: Select all
My output format is:
if I am printing team position: printf("%2d.%16s%4d%4d%4d%4d%4d "); etc etc...
else printf("%19s%4d%4d%4d%4d%4d "); etc....
(I added the percentage later)
Re: 10698 - Football Sort
Posted: Thu Nov 12, 2015 7:27 am
by seeva92
Hi all,
I am stuck with this problem. Anyone help me out on where my code fails
Code: Select all
#include <iostream>
#include <cstdlib>
#include <cstring>
#include <vector>
#include <algorithm>
#include <sstream>
#include <set>
#include <climits>
#include <cstdio>
#include <string>
#include <map>
#include <unordered_map>
#ifndef ONLINE_JUDGE
#define getc_unlocked getc
#define putc_unlocked putc
#endif
using namespace std;
struct Team {
string name;
int scored = 0;
int suffered = 0;
int points = 0;
int played = 0;
int difference = 0;
int idx = 0;
};
int getpoints(int goal1, int goal2) {
if (goal1 == goal2)
return 1;
else if (goal1 > goal2)
return 3;
return 0;
}
bool compare(Team team1, Team team2) {
if (team1.points > team2.points)
return true;
else if (team1.points == team2.points) {
if (team1.difference > team2.difference)
return true;
else if (team1.difference == team2.difference) {
if (team1.scored > team2.scored)
return true;
else if (team1.scored == team2.scored) {
transform(team1.name.begin(), team1.name.end(), team1.name.begin(), ::tolower);
transform(team2.name.begin(), team2.name.end(), team2.name.begin(), ::tolower);
if (team1.name <= team2.name)
return true;
return false;
}
return false;
}
return false;
}
return false;
}
int main() {
#ifndef ONLINE_JUDGE
freopen("1.txt", "r", stdin);
freopen("2.txt", "w", stdout);
#endif
register int g, t;
string str;
register int goal1, goal2;
char c;
cin >> g >> t;
while (g || t) {
map<string, int> teamMap;
vector<Team> teamList;
int idx = 0;
while (g--) {
cin >> str;
Team team; team.name = str; team.idx = idx;
teamList.push_back(team);
teamMap[str] = idx++;
}
while (t--) {
cin >> str >> goal1 >> c >> goal2;
Team & team = teamList[teamMap[str]];
team.scored += goal1;
team.suffered += goal2;
team.points += getpoints(goal1, goal2);
team.played++; team.difference = team.scored - team.suffered;
cin >> str;
Team &team1 = teamList[teamMap[str]];
team1.scored += goal2;
team1.suffered += goal1;
team1.points += getpoints(goal2, goal1);
team1.played++; team1.difference = team1.scored - team1.suffered;
}
stable_sort(teamList.begin(), teamList.end(), compare);
double result = 0.0f;
char na[] = "N/A";
for (int i = 1; i <= (int)teamList.size(); i++) {
result = ((double(teamList[i - 1].points)) / (double(teamList[i - 1].played * 3))) * (double(100));
if (i - 2 >= 0) {
if ((teamList[i - 1].points == teamList[i - 2].points) && (teamList[i - 1].difference == teamList[i - 2].difference) && (teamList[i - 1].scored == teamList[i - 2].scored))
printf("%19s%4d%4d%4d%4d%4d ", teamList[i - 1].name.c_str(), teamList[i - 1].points, teamList[i - 1].played, teamList[i - 1].scored, teamList[i - 1].suffered, teamList[i - 1].difference);
else
printf("%2d.%16s%4d%4d%4d%4d%4d ", i, teamList[i - 1].name.c_str(), teamList[i - 1].points, teamList[i - 1].played, teamList[i - 1].scored, teamList[i - 1].suffered, teamList[i - 1].difference);
} else
printf("%2d.%16s%4d%4d%4d%4d%4d ", i, teamList[i - 1].name.c_str(), teamList[i - 1].points, teamList[i - 1].played, teamList[i - 1].scored, teamList[i - 1].suffered, teamList[i - 1].difference);
if (result != result)
printf("%6s\n", na);
else
printf("%6.2f\n", result);
}
cin >> g >> t;
if (g != 0 && t != 0)
printf("\n");
}
}