11056 - Formula 1

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

Moderator: Board moderators

User avatar
Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

11056 - Formula 1

Post by Martin Macko » Sun Aug 06, 2006 12:15 am

It was really frustrating during the contest that the problem description didn't say the pilots names should be sorted case insensitively. I got planty of WA's for comparing them by builtin operator<(string, string), which is case sensitive.

Leonid
Experienced poster
Posts: 146
Joined: Thu Dec 22, 2005 5:50 pm
Contact:

Re: 11056: Formula 1

Post by Leonid » Sun Aug 06, 2006 12:18 am

Martin Macko wrote:It was really frustrating during the contest that the problem description didn't say the pilots names should be sorted case insensitively. I got planty of WA's for comparing them by builtin operator<(string, string), which is case sensitive.
lexicografically - means case insensitive comparison. So you shouldn't assume that "compare lexicografically" means "compare by ASCII value"

User avatar
Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Re: 11056: Formula 1

Post by Martin Macko » Sun Aug 06, 2006 12:30 am

Leonid wrote:lexicografically - means case insensitive comparison. So you shouldn't assume that "compare lexicografically" means "compare by ASCII value"
I'm not a native english speaker, but I don't think that 'lexicografically' implies 'case insensitive' automaticly. IMHO 'lexicografical comparison' of two sequences of objects means comparing the objects one to one from the beginnings of the sequences until we find a pair of different objects on respective positions in the sequences or one of the sequences ends. Therefore 'lexicografical comparison' doesn't say anything about what kind of comparison we use to compare the contained objects.

Darko
Guru
Posts: 580
Joined: Fri Nov 11, 2005 9:34 am
Location: Calgary, Canada

Post by Darko » Sun Aug 06, 2006 12:33 am

(EDIT: Q was to Leonid)
So, what would be the answer to
2
Aa 59 min 59 sec 999 ms
aA 59 min 59 sec 999 ms
?

Whatever you say - where is that ordering explicitly mentioned?

User avatar
arsalan_mousavian
Experienced poster
Posts: 111
Joined: Mon Jan 09, 2006 6:19 pm
Location: Tehran, Iran
Contact:

Post by arsalan_mousavian » Sun Aug 06, 2006 1:45 am

i 've got 15 PE during the contest , and i don't understrand why this happens
could some one take a look at my code

Code: Select all

cut off after finding my silly mistake
Last edited by arsalan_mousavian on Sun Aug 06, 2006 2:08 am, edited 1 time in total.
In being unlucky I have the record.

User avatar
Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Post by Martin Macko » Sun Aug 06, 2006 1:52 am

arsalan_mousavian wrote:i 've got 15 PE during the contest , and i don't understrand why this happens
could some one take a look at my code
Write
.........cout << "Row " << ++rowCount << endl ;
instead of
.........cout << "Row" << ++rowCount << endl ;

User avatar
arsalan_mousavian
Experienced poster
Posts: 111
Joined: Mon Jan 09, 2006 6:19 pm
Location: Tehran, Iran
Contact:

Post by arsalan_mousavian » Sun Aug 06, 2006 2:09 am

oh , no , you know i think i print some extra new line , thanks for reply
In being unlucky I have the record.

StatujaLeha
Learning poster
Posts: 91
Joined: Tue May 31, 2005 2:01 pm
Location: Russia

Post by StatujaLeha » Sun Aug 06, 2006 9:44 am

please, give me output for next test cases:
3
Schumacher : 1 min 23 sec 172 ms
Barrichello : 2 min 12 sec 999 ms
Senna : 0 min 55 sec 582 ms

4
Schumacher : 1 min 23 sec 172 ms
Barrichello : 2 min 12 sec 999 ms
Senna : 0 min 55 sec 582 ms
Fangio : 1 min 03 sec 000 ms

2
BadPilot : 59 min 59 sec 999 ms
ABadPilot : 59 min 59 sec 999 ms

5
M.Schumacher : 1 min 22 sec 172 ms
R.Schumacher : 1 min 23 sec 172 ms
Barrichello : 2 min 12 sec 999 ms
Senna : 0 min 55 sec 582 ms
Fangio : 1 min 03 sec 000 ms

5
M.Schumacher : 1 min 22 sec 172 ms
R.Schumacher : 1 min 23 sec 172 ms
team-1 : 2 min 12 sec 999 ms
team-2 : 0 min 55 sec 582 ms
team-3 : 1 min 03 sec 000 ms


5
M.Schumacher : 1 min 22 sec 172 ms
R.Schumacher : 1 min 23 sec 172 ms
team-1 : 2 min 12 sec 999 ms
team-2 : 0 min 55 sec 582 ms
team-3 : 1 min 03 sec 000 ms

10
M.Schumacher : 1 min 22 sec 172 ms
R.Schumacher : 1 min 23 sec 172 ms
Barrichello : 2 min 12 sec 999 ms
Senna : 0 min 55 sec 582 ms
Fangio : 1 min 03 sec 000 ms
M.Schumacher : 1 min 22 sec 172 ms
R.Schumacher : 1 min 23 sec 172 ms
Barrichello : 2 min 12 sec 999 ms
Senna : 0 min 55 sec 582 ms
Fangio : 1 min 03 sec 000 ms

10
M.Schumacher : 1 min 22 sec 172 ms
R.Schumacher : 1 min 23 sec 172 ms
Barrichello : 2 min 12 sec 999 ms
Senna : 0 min 55 sec 582 ms
Fangio : 1 min 03 sec 000 ms
M.Schumacher1 : 1 min 22 sec 172 ms
R.Schumacher1 : 1 min 23 sec 172 ms
Barrichello1 : 2 min 12 sec 999 ms
Senna1 : 0 min 55 sec 582 ms
Fangio1 : 1 min 03 sec 000 ms

10
M.Schumacher1 : 1 min 22 sec 172 ms
R.Schumacher1 : 1 min 24 sec 172 ms
Barrichello1 : 2 min 12 sec 999 ms
Senna1 : 0 min 55 sec 582 ms
Fangio1 : 1 min 03 sec 000 ms
M.Schumacher2 : 1 min 23 sec 172 ms
R.Schumacher2 : 1 min 25 sec 172 ms
Barrichello2 : 2 min 13 sec 999 ms
Senna2 : 0 min 56 sec 582 ms
Fangio2 : 1 min 13 sec 000 ms

10
M.Schumacher1 : 1 min 22 sec 172 ms
R.Schumacher1 : 1 min 24 sec 172 ms
Barrichello1 : 2 min 12 sec 999 ms
Senna1 : 0 min 55 sec 582 ms
Fangio1 : 1 min 03 sec 000 ms
M.Schumacher2 : 7 min 23 sec 172 ms
R.Schumacher2 : 6 min 25 sec 172 ms
Barrichello2 : 5 min 13 sec 999 ms
Senna2 : 9 min 56 sec 582 ms
Fangio2 : 8 min 13 sec 000 ms

10
M.Schumacher : 1 min 22 sec 172 ms
R.Schumacher : 1 min 24 sec 172 ms
Barrichello : 2 min 12 sec 999 ms
Senna : 0 min 55 sec 582 ms
Fangio : 1 min 03 sec 000 ms
M.Schumacher : 7 min 23 sec 172 ms
R.Schumacher : 6 min 25 sec 172 ms
Barrichello : 5 min 13 sec 999 ms
Senna : 9 min 56 sec 582 ms
Fangio : 8 min 13 sec 000 ms

10
M.Schumacher : 1 min 22 sec 172 ms
R.Schumacher : 1 min 24 sec 172 ms
Barrichello : 2 min 12 sec 999 ms
Senna : 0 min 55 sec 582 ms
Fangio : 1 min 03 sec 000 ms
M.Schumacher : 7 min 23 sec 172 ms
R.Schumacher : 6 min 25 sec 172 ms
Barrichello : 5 min 13 sec 999 ms
Senna : 9 min 56 sec 582 ms
Fangio : 8 min 13 sec 000 ms
Last edited by StatujaLeha on Sun Aug 06, 2006 10:33 am, edited 2 times in total.

jan_holmes
Experienced poster
Posts: 136
Joined: Fri Apr 15, 2005 3:47 pm
Location: Singapore
Contact:

Post by jan_holmes » Sun Aug 06, 2006 9:50 am

My AC program gives :
removed... see below...
But I think all input testcases for the name of the driver will be 1 word (not separated), so some of your inputs might not be valid...

Hope it helps... :wink:
Last edited by jan_holmes on Sun Aug 06, 2006 10:51 am, edited 2 times in total.

StatujaLeha
Learning poster
Posts: 91
Joined: Tue May 31, 2005 2:01 pm
Location: Russia

Post by StatujaLeha » Sun Aug 06, 2006 10:25 am

thanks jan_holmes. I changed pilot's names in my previous post. Can someone give me output for it?

jan_holmes
Experienced poster
Posts: 136
Joined: Fri Apr 15, 2005 3:47 pm
Location: Singapore
Contact:

Post by jan_holmes » Sun Aug 06, 2006 10:49 am

Here it is :
Row 1
Senna
Schumacher
Row 2
Barrichello

Row 1
Senna
Fangio
Row 2
Schumacher
Barrichello

Row 1
ABadPilot
BadPilot

Row 1
Senna
Fangio
Row 2
M.Schumacher
R.Schumacher
Row 3
Barrichello

Row 1
team-2
team-3
Row 2
M.Schumacher
R.Schumacher
Row 3
team-1

Row 1
team-2
team-3
Row 2
M.Schumacher
R.Schumacher
Row 3
team-1

Row 1
Senna
Senna
Row 2
Fangio
Fangio
Row 3
M.Schumacher
M.Schumacher
Row 4
R.Schumacher
R.Schumacher
Row 5
Barrichello
Barrichello

Row 1
Senna
Senna1
Row 2
Fangio
Fangio1
Row 3
M.Schumacher
M.Schumacher1
Row 4
R.Schumacher
R.Schumacher1
Row 5
Barrichello
Barrichello1

Row 1
Senna1
Senna2
Row 2
Fangio1
Fangio2
Row 3
M.Schumacher1
M.Schumacher2
Row 4
R.Schumacher1
R.Schumacher2
Row 5
Barrichello1
Barrichello2

Row 1
Senna1
Fangio1
Row 2
M.Schumacher1
R.Schumacher1
Row 3
Barrichello1
Barrichello2
Row 4
R.Schumacher2
M.Schumacher2
Row 5
Fangio2
Senna2

Row 1
Senna
Fangio
Row 2
M.Schumacher
R.Schumacher
Row 3
Barrichello
Barrichello
Row 4
R.Schumacher
M.Schumacher
Row 5
Fangio
Senna

Row 1
Senna
Fangio
Row 2
M.Schumacher
R.Schumacher
Row 3
Barrichello
Barrichello
Row 4
R.Schumacher
M.Schumacher
Row 5
Fangio
Senna

StatujaLeha
Learning poster
Posts: 91
Joined: Tue May 31, 2005 2:01 pm
Location: Russia

Post by StatujaLeha » Sun Aug 06, 2006 11:09 am

thanks a lot, got accepted.

Leonid
Experienced poster
Posts: 146
Joined: Thu Dec 22, 2005 5:50 pm
Contact:

Re: 11056: Formula 1

Post by Leonid » Sun Aug 06, 2006 6:01 pm

Martin Macko wrote:IMHO 'lexicografical comparison' of two sequences of objects means comparing the objects one to one from the beginnings of the sequences until we find a pair of different objects on respective positions in the sequences or one of the sequences ends. Therefore 'lexicografical comparison' doesn't say anything about what kind of comparison we use to compare the contained objects.
Exactly - THE objects. And the objects are strings ;) Finally, I agree that this 'lexicografical' comparison should've been more detailed. Author of this problem thought that "lexicografical comparison" doesn't imply case-sensitivity. I've made the same mistake as the most of us. After few asserts i've found what "actually" lexicografical comparison is and solved the problem. I believe that most of us could have solved this problem that way.

User avatar
Martin Macko
A great helper
Posts: 481
Joined: Sun Jun 19, 2005 1:18 am
Location: European Union (Slovak Republic)

Re: 11056: Formula 1

Post by Martin Macko » Sun Aug 06, 2006 9:43 pm

Leonid wrote:Exactly - THE objects. And the objects are strings ;)
No, in this case "the objects" are chars. Strings are sequences of "the objects", i.e. the chars. :wink:

Leonid
Experienced poster
Posts: 146
Joined: Thu Dec 22, 2005 5:50 pm
Contact:

Re: 11056: Formula 1

Post by Leonid » Sun Aug 06, 2006 10:24 pm

Martin Macko wrote:
Leonid wrote:Exactly - THE objects. And the objects are strings ;)
No, in this case "the objects" are chars. Strings are sequences of "the objects", i.e. the chars. :wink:
yeah..and each char is composed of some dots on your monitor, while each dot is a set of a molecules, and each molecule is then divided into atoms and each atom is known to be a composite structure of quarks...can you go any further? :o
So let's just sort quarks lexicografically - isn't it gonna be fun? :)

Post Reply

Return to “Volume 110 (11000-11099)”