Discussion of Problem 1731. DillShow all threads Hide all threads Show all messages Hide all messages | Why so easy? | Timur | 1731. Dill | 19 Nov 2024 22:44 | 1 | | when it may be «It is a lie!». | McArchuk | 1731. Dill | 8 Aug 2022 11:12 | 6 | when it may be «It is a lie!». Edited by author 08.08.2022 11:27 | RANDOM solution is OK! | Mahilewets | 1731. Dill | 24 Jun 2017 23:17 | 1 | Just output n random numbers. After that, output m random numbers. All random numbers are in range [1;1e9]. AC first attempt. | idea | dustbite | 1731. Dill | 8 Nov 2016 09:43 | 1 | idea dustbite 8 Nov 2016 09:43 there are n * m possible sums. to find a solution, we can try to create such vectors such that all n * m sums are different. Suppose the 1st vector is 1 2 3 ... n Then the first element of next vector is taken to be n + 1(we require all unique). Now we need to find the next element while making all n*p sums different, where p is the size of the 2nd vector. n+1 1 2 3 ... n initially all sums(n+2 to 2n+1) are distinct. Now we need to add new element such that smallest possible new sum is greater than the previous sum i.e. if new element is p p+1>2n+1 or p >= 2n + 1 in general p+1>prev+n p>=prev+n | Solution | Roland | 1731. Dill | 16 Aug 2016 00:44 | 13 | Very easy:) just print numbers 1,2,...,n then n+1,2*n+1,...,m*n+1 Sorry,can you explain why... Thank you. because if you take any 2 numbers(a1,a2) from the 2 line and any 2 numbers(b1,b2) from the 3 line, a1+b1!=a2+b2 and a1+b2!=a2+b1... or 1, 2, 3, ... n 100, 200, 300, m*100 :) Can someone explain me why following solution incorrect? 1,2,3,..,n n, 2*n+1, 3*n+2, .. m*n+m-1 I got WA#1 with it. cause you have n twice Can someone explain me why following solution incorrect? 1,2,3,..,n n, 2*n+1, 3*n+2, .. m*n+m-1 I got WA#1 with it. _ Edited by author 20.04.2010 00:42 I had done as you saggest and after my program was crashed on 6 test. What it means? And what me do now? Please help, because it very importent for me. Thank you for advance! Very easy:) just print numbers 1,2,...,n then n+1,2*n+1,...,m*n+1 Everithing is done! Sorry for my mindless please. You may write random numbers and get AC@) it's not true. random numbers can't be always true. In fact sometimes random numbers can be equal.in statement is's written that equal numbers should not be. And even if won't be equals is possible to catch WA. Sorry for bad Englis.:) Excuse me again. I would like to know from what thinking I can gone to this solution. Because I must to explain my teacher why this variant of solution is correct.Please explain me how to gone to such solution logically or vhere I can read about it. Thank you for advance! Very easy:) just print numbers 1,2,...,n then n+1,2*n+1,...,m*n+1 | Why so? | →MOPDOBOPOT← | 1731. Dill | 16 Aug 2016 00:37 | 3 | Why so? →MOPDOBOPOT← 17 Jan 2010 12:44 input: 2 3 Output: 1 2 3 5 7 Why this result failed 1 test? Why did you decide that the first test is this? | why wa1 | IlushaMax | 1731. Dill | 7 Jul 2016 16:49 | 1 | var m,n:word; i:word; begin readln(m,n); for i:=1 to n do begin write(i,' '); end; writeln; for i:=1 to m do begin write(i*n+1,' '); end; end. What test is wrong with it? Edited by author 07.07.2016 17:05 | to authors | arrammis | 1731. Dill | 11 Apr 2016 14:47 | 2 | Why this answer for test 1 gets WA 2 3 1 2 3 4 5 ????????? algorithm is just print on 1 ... n then n+1 ... n+m what's wroung with this??????????????? The algorithm is not 1 ... n n+1 ... n+m In your answer 1 + 4 = 2 + 3 This violates the condition "Ivan Vasil'evich considered all the possible variants and saw that this was impossible" | easy!!! | [TDUweAI] daminus | 1731. Dill | 27 Jun 2013 01:06 | 1 | easy!!! [TDUweAI] daminus 27 Jun 2013 01:06 1...n print(i) (n+1)...n+m print(i*n) | Check your tests. | larev01 | 1731. Dill | 26 Apr 2012 07:47 | 3 | The tests are a little bit incorrect. If we have, let's say, 10 boxes of the first variety and 10 boxes of the second variety we can come up with: 1 2 3 4 5 6 7 8 9 10 10 20 30 40 50 60 70 80 90 100 (1 line: from 1 to n; 2 line: from n to m*n with step of n) In this case we never allocate boxes of even weight. If we take box number 10 from the first line and box number 3 from the second, we get 10+30=40. The best solution would be the box number 1 from the first line and the box number 4 from the second one: 1+40=41. But 40!=41 The system gives me WA on the very first test. All integers in output must be different, so your answer is wrong. Oops... Indeed! Shame on my inattention :( Thanks, mate! | Always read the statement | Pastafarianist | 1731. Dill | 26 Nov 2011 22:04 | 1 | 1, 2, 3, ..., n 1, n+1, 2n+1, ..., (m-1)*n+1 I have even written a testing program to verify this and it reports that there is no mistake. I checked this on a few inputs like (2, 3), (1, 50), (50, 1), (50, 50) and it always seems to be correct. Can anybody give me a hint on where my mistake is? UPD: Got AC after changing to this: 1, 2, 3, ..., n n+1, 2n+1, ..., m*n+1 The question remains. WTF? UPD2: Read the statement again and figured this out. All number should be different. In my solution, 1 was repeated twice. Edited by author 26.11.2011 22:13 |
|
|