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 1571. Interpreters

Solution
Posted by MSDN 14 Oct 2007 13:54
This problem is very easy!.
if N=1 output is  0;
if N=2 and first language=second language output is 0;
if N=2 and first language not = second language output "first"-"second" (fist and second - it's name of language)
If N>2 if there are two or many equal languages output "Impossible"
If N>2 if all languages different you print N and print all name languages this your language.
Your language it is thought up string of latin letters. But dangerous this it. your language will be string len<10 and latin letters in small case.

Tests:
input:
1
a
output:
0

input:
2
a
a
output:
0

input:
2
a
b
output:
a-b

input:
3
a
b
c
output:
a-qwerty
b-qwerty
c-qwerty

input:
3
a
a
b
output:
Impossible
Re: Solution
Posted by Denis Koshman 14 Jul 2008 19:41
There is one more case when N>2 and all languages are the same.
Re: Solution
Posted by Anupam Ghosh, Wipro Technologies 4 Jul 2013 19:43
"There is one more case when N>2 and all languages are the same".
As per problem " Developers also settled if two crews are communicating then other crews must not understand a word because in that case other crew will listen instead of work and towers will not be constructed by the time".
Hence the output should be "Impossible" for this case.