ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1040. Airline Company

Is 1,2,4,6,5,3 also right??????????
Posted by bobchennan 3 May 2009 09:55
Who can tell me?
I have WA1.
Thanks a lot.

Edited by author 03.05.2009 09:55

Edited by author 03.05.2009 09:56

Edited by moderator 13.05.2009 01:51
Re: Is 1,2,4,6,5,3 also right??????????
Posted by Kurpilyansky Eugene (USU) 3 May 2009 23:25
"If there are several flights that depart from one airport then the greatest common divisor of their flight numbers should be equal to 1."

input
6 6
1 2
2 3
2 4
4 3
5 6
4 5
output
1 2 4 6 5 3
This output isn't correct because for second flight (2, 3) gcd is equal to 2 != 1.

Edited by moderator 13.05.2009 01:52
Re: Is 1,2,4,6,5,3 also right??????????
Posted by MAK 22 Jul 2010 09:52
O_o

"If there are several FLIGHTS that depart from one AIRPORT then the greatest common divisor of their flight numbers should be equal to 1."

Why did you calculate gcd for the second flight? Output is a numbers of flights, not numbers of flights.

May be you should do this for the second airport. However gcd of the flight numbers of the second airport is gcd(1,2,4) = 1.

P.S. I think output is not right because gcd of the flight numbers from the airport #3 is equal to 2.

Edited by author 22.07.2010 10:00