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 1964. Chinese Dialects

WA #13. Dear Author, please comment
Posted by Darwin's Grove 24 Feb 2014 14:43
            long min = n;
            for (int i = 0; i < k; i++)
                for (int j = i + 1; j < k; j++) {
                    long diff = (data[i] + data[j] - n);
                    if (diff < min)
                        min = diff;
                }
            Console.WriteLine(min < 0 ? 0 : min);
Re: WA #13. Dear Author, please comment
Posted by Darwin's Grove 24 Feb 2014 15:06
Sorry, it's my fault. This case find Max, not Min.
Re: WA #13. Dear Author, please comment
Posted by Oleksandr Ushkalenko 28 Jan 2015 00:18
Does you algorithm work (with your last changes)?
Re: WA #13. Dear Author, please comment
Posted by Paul Komarnytskyy 21 Jun 2015 18:21
It probably shouldn't (if I am correct)

Consider the following
3 3
2 2 2
The answer, program will give you in this case is 1

But i can easily prove it is wrong:

First man speaks dialects 1 and 2
Second one speaks dialects 2 and 3
The third speaks dialects 3 and 1

Therefore there is nobody, who can speak all three dialects
Re: WA #13. Dear Author, please comment
Posted by jim 3 Jul 2018 08:03
you help a lot,thank you