Show all threads Hide all threads Show all messages Hide all messages |
Test for WA#17 | Zhabka | 1964. Chinese Dialects | 23 Jul 2021 13:56 | 1 |
|
Why find two mins is wrong algoritm? | AlexRad | 1964. Chinese Dialects | 18 Jul 2019 07:19 | 3 |
What is correct algorithm? My program that find 2 mins and print Math.Max(min1 + min2 - n, 0) don't pass test 13. Consider test 3 3 2 2 2 Your solution says that there is a person who knows three different dialects. But we can construct an example where it is not true: 1) first person knows dialects number 1 and 2 2) second knows 1 and 3 3) third knows 2 and 3 Do u give me ur wrong code? |
Can you explain this problem? | bad dream | 1964. Chinese Dialects | 18 Jun 2019 18:10 | 1 |
Can you please explain what this problem is asking? Input: 10 2 8 8 Output: 6 Input: 10 3 8 8 8 Output: 4 Can you explain how the output is changing? What's the logic/intuition behind this? Please explain in details. |
wa #15 | 👑TIMOFEY👑 | 1964. Chinese Dialects | 8 Jan 2019 00:11 | 1 |
wa #15 👑TIMOFEY👑 8 Jan 2019 00:11 (yes, somehow I've got wa15) try this test (it helped me to get AC): 10 3 7 7 7 |
This testcase helped me to fix WA13 | tepamid | 1964. Chinese Dialects | 1 Nov 2018 13:14 | 1 |
|
WA #13. Dear Author, please comment | Darwin's Grove | 1964. Chinese Dialects | 3 Jul 2018 08:03 | 5 |
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); Sorry, it's my fault. This case find Max, not Min. Does you algorithm work (with your last changes)? 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 |
in case of WA#4 | nikitaevg | 1964. Chinese Dialects | 3 Jul 2018 06:56 | 4 |
Just use __int64 instead of long long. That helped me. int is enough for this problem. Using 64-bit ints didn't matter for my solution. However, this test case helped me fix WA 4: 10 3 5 4 8 |
Why compilation ERROR?!?!?!?!? WTF?!?!?!? | Ivan Metelev | 1964. Chinese Dialects | 25 May 2016 11:30 | 3 |
var a,i,b,n,k: int64; begin readln(n,k); for i:=1 to k do begin read(a); b:=b+a; end; writeln(b-n); end. In the "For" can not be used "int64" |
WA#13 FreePascal | Desire | 1964. Chinese Dialects | 14 Jan 2016 04:03 | 3 |
Here is my code. What is wrong? Help, please! var m,n:int64; k,i:0..20; a:array[1..20] of int64; begin read(n,k); for i:=1 to k do read(a[i]); for i:=2 to k do if a[i]<a[i-1] then begin m:=a[i]; a[i]:=a[i-1]; a[i-1]:=m end; m:=n-(n-a[1])-(n-a[2]); if m<=0 then write(0) else write(m); end. Edited by author 02.11.2013 04:21 You must only write((a1+a2+...+ak)-n) That's all)) Good luck! no, right answer is ((a1+a2+...+ak)-n * (k-1)) |
Test # 13 why? | AlexRad | 1964. Chinese Dialects | 14 Apr 2015 09:35 | 1 |
var min1 = n; var min2 = n; for (var i = 0; i < k; i++) { var a = vals[i]; if (a < min1) { min2 = min1; min1 = a; } else if (a < min2) min2 = a; } Console.WriteLine(Math.Max(min1 + min2 - n, 0)); |
Everyone speaks at least one language? | Orfest (Novosibirsk SU) | 1964. Chinese Dialects | 28 Jan 2015 00:14 | 2 |
Does everyone speak at least one dialect? |
Test13 Wrong answer | KoshMar | 1964. Chinese Dialects | 27 Jan 2015 23:54 | 3 |
Why? --- My fault Edited by author 29.06.2013 02:09 this problem is very very easy ,some hints from AC code ......... for(i=0;i<k;i++){ ......... s+=n-t; } n-=s; if(n<0) n=0; ...... I didnot undestand why //Сложность: 308 // ????!!! The issue is for minimization. Edited by author 28.01.2015 00:41 |
WA #7 What is the problem? Pascal | Mosca Felice | 1964. Chinese Dialects | 27 Jan 2015 23:29 | 2 |
var a: int64; n:int64; sum:int64; i,k:integer; begin read(n,k); a:=0; sum:=0; for i:=1 to k do begin read(a); sum:=sum+a; end; if sum-n >=0 then write(sum - n) else write('0'); end. Edited by author 03.01.2015 03:26 Edited by author 03.01.2015 03:27 Algorithm mistake, example: 2 3 2 2 2 Your answer is 4, but should be 2. Edited by author 27.01.2015 23:29 |
Is sum a_i >= n | Orfest (Novosibirsk SU) | 1964. Chinese Dialects | 17 Jan 2015 20:26 | 2 |
Is it guaranteed that a1+a2+...+ak >= n? |
WA #13, what's the issue? | Holykill (AUA) | 1964. Chinese Dialects | 3 Dec 2014 21:31 | 1 |
so what is the trick with the test 13? Here is my code: public static void main(String[] args) { Scanner input = new Scanner(System.in); int n = input.nextInt(); int k = input.nextInt(); long[] arr = new long[k]; long first = 20000000000000L; int first_location = 0; long second = 2000000000000L; for (int i = 0; i < k; i++) arr[i] = input.nextInt();
for (int i = 0; i < k; i++) if (arr[i] < first) { first = arr[i]; first_location = i; } arr[first_location] = 0;
for (int i = 0; i < k; i++) if (arr[i] < second && arr[i] != 0) second = arr[i]; long answer = first + second - n; if (answer > 0) System.out.println(answer); else System.out.println(0);
} |
More test! | Daniel | 1964. Chinese Dialects | 1 Aug 2014 00:41 | 1 |
Please, give me a more test with answer. |
Test 7 | Arthur Timergalin | 1964. Chinese Dialects | 5 Jul 2014 22:44 | 1 |
Test 7 Arthur Timergalin 5 Jul 2014 22:44 - Edited by author 05.07.2014 22:48 |
WA#13 please help me in JAVA 1.7 | Axmadjon | 1964. Chinese Dialects | 6 Jun 2014 12:28 | 1 |
import java.util.*; public class Test_1874 { public static void main(String[] args) { @SuppressWarnings("resource") Scanner s = new Scanner(System.in); int n, k, m; n = s.nextInt(); k = s.nextInt(); long[] a = new long[k]; for (int i = 0; i < k; i++) { a[i] = s.nextInt(); } for (int i = 1; i < k; i++) { if (a[i] < a[i - 1]) { m = (int) a[i]; a[i] = a[i - 1]; a[i - 1] = m; } } m = (int) (n - (n - a[0]) - (n - a[1])); if (m <= 0) { System.out.println("0"); } else { System.out.println(m); } } } |
Cantonese is hard to learn | raven | 1964. Chinese Dialects | 19 Aug 2013 00:11 | 1 |
|
TL1, WTF? | PrankMaN | 1964. Chinese Dialects | 9 Aug 2013 13:52 | 1 |
TL1 with G++ but AC 0.015 with VC++ 2010? My solution is only 14 strings and only one cycle to read ai. |