Show all threads Hide all threads Show all messages Hide all messages |
WA test 24.... HELP!! | vtalgo25_zakharchenko_408648 | 1604. Country of Fools | 25 Mar 2025 05:22 | 2 |
|
Please tell me what is the test 6? | quocanh34 | 1604. Country of Fools | 27 Mar 2023 22:09 | 1 |
|
WA Test 8 | Mar-i-ya | 1604. Country of Fools | 18 Apr 2022 01:46 | 1 |
|
using java, how to make mem usage about 3M? | howard li | 1604. Country of Fools | 12 Apr 2022 10:27 | 1 |
I try heap and sort to get AC using java, but memory usage is about 7M. I browse the java submits, and find some top-rank solution only using about 3M memory. e.g. commit 9822957 by @hduads2022_20321226, 0.14 secs, 2908 KB. commit 9290600 by @Mikhail, 0.109 secs, 1 272 KB. how to lower the memory usage. |
WA Test 5 | Julik | 1604. Country of Fools | 16 Jul 2021 17:54 | 4 |
Mb you forgot to sort your array or vector before start printing anything |
What's your algo? | ACSpeed | 1604. Country of Fools | 5 Jan 2020 23:27 | 5 |
Can you guys share your approach ( and proof if possible ) because mine, though AC, is not very certain. I rely on greedy approach which output pairs with maximum number and minimum number. Use sort and find min and max after output each pair. Quite slow, 0.14s :) Greedy approach is fine but why output pairs with maximum number and minimum number ?? Can you guys share your approach ( and proof if possible ) because mine, though AC, is not very certain. I rely on greedy approach which output pairs with maximum number and minimum number. Use sort and find min and max after output each pair. Quite slow, 0.14s :) I used a max heap in which I hold pairs like, number i (index of the sign) and frequency of that sign. Each time I pop out from that heap the 2 index with maximal frequency, decrement their frequency and update the heap from their indexes. I was sure that there is a more simplier aproach to that problem(like greedy), without using heap, but I was just 99.9% sure that with heap I will got AC, and so it was. :) The same here. I'm using heap, but I'm pulling entries one by one, decrementing and not adding them back until next entry is pulled. I was 146% sure this would work when I decided to implement this algo and it not that bad in terms of time: O(n log k). But I wondered if there is a simple straightforward algo that also would work. Turned out there is. I created an array of pairs (quantity, index) and sorted it. Output the maximum and the next one with a positive quantity, and if there are elements with the same quantity that remains at the maximum, I output them the same way, each step decreasing the number of the output element Sorry for my English tests with my answers: 4 8 5 4 3 1 2 1 2 1 2 1 2 1 2 3 1 3 4 1 3 4 1 3 4 5 9 7 4 4 3 1 2 1 2 1 2 1 2 1 2 1 2 4 3 1 2 4 3 5 1 4 3 5 1 4 3 5 |
WA 20 | vtalgo19_manisimova | 1604. Country of Fools | 5 Jan 2020 22:45 | 2 |
WA 20 vtalgo19_manisimova 23 Apr 2019 14:58 Test 3 3 3 3 3 1 2 7 5 7 5 4 1 1 Edited by author 05.01.2020 22:51 Edited by author 05.01.2020 23:18 |
Fixed runtime errorr 25 | Arseniy | 1604. Country of Fools | 13 May 2019 04:24 | 1 |
I had runtime error 25, but when i surrounded sorting with try catch it accepted Any ideas why? |
Pleases, give your opinion to this TEST | Sanatbek_Matlatipov | 1604. Country of Fools | 18 Jan 2017 19:38 | 3 |
2 1 10 My output is: 2 1 2 2 2 2 2 2 2 2 2 Is this corret or Did I understand task wrong..? Please, Also tell me Test #5,6 Edited by author 14.09.2015 18:16 |
WA 3 | wszedziesmierc | 1604. Country of Fools | 25 Apr 2013 00:28 | 2 |
WA 3 wszedziesmierc 27 Jan 2011 00:17 I've got no idea what's wrong. What's the test? Try the test 1 10 That might help even though the answer is obvious :) |
WA 2 What is test 2? | xurshid_n | 1604. Country of Fools | 27 Mar 2013 12:58 | 2 |
You can try with 2 2 3 The output should look like this 2 1 2 1 2 |
Ctrl+A+Delete | MOPDOBOPOT (USU) | 1604. Country of Fools | 12 Feb 2011 00:56 | 1 |
If you can't find the mistake! :) Edited by author 28.05.2011 17:04 |
WA#4, help!!!!!!!!!! here is my code | Bobur | 1604. Country of Fools | 10 Feb 2011 00:03 | 10 |
var a, b, c : array [1..10000] of integer; k, n, s, i, j : integer; toq : boolean; procedure quicksort; procedure sort(l, r : integer); var i1, j1, x, w : integer; begin i1 := l; j1 := r; x := a[(l+r) div 2]; repeat while a[i1]<x do inc(i1); while x<a[j1] do dec(j1); if i1 <= j1 then begin w := a[i1]; a[i1] := a[j1]; a[j1] := w; w := b[i1]; b[i1] := b[j1]; b[j1] := w; inc(i1); dec(j1); end; until i1 > j1; if l < j1 then sort(l, j1); if i1 < r then sort(i1, r); end; begin sort(1, n); end;{quicksort} begin read(n); for k := 1 to n do begin read(a[k]); b[k] := k; end; s := 0; for k := 1 to n do s := s + a[k]; quicksort; toq := true; for k := 1 to n do begin if toq then begin j := 1; i := 1; while (i <= s) and (j <= a[k]) do begin c[i] := b[k]; inc(i, 2); inc(j); end; if i > s then toq := false; end; if toq = false then begin j := 1; i := 2; while (i <= s) and (j <= a[k]) do begin c[i] := b[k]; inc(i, 2); inc(j); end; end; end; for i := 1 to s do write(c[i], ' '); end. or smth wrong with my idea!!! check this test 3 5 8 10 correct answer 1 3 2 3 1 3 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 2 3 Edited by author 02.03.2008 21:38 And this: 3 1 2 5 Answer: 3 1 3 2 3 2 3 3 thx Bobur 19 Mar 2008 18:26 test : 3 5 8 10 answer: will be this answer correct too? 1 2 3 2 1 2 3 2 1 2 3 2 1 2 3 2 1 2 3 2 1 2 3 Edited by author 30.10.2008 11:39 and this? 3 5 8 10 answer: 3 2 3 2 3 2 3 1 3 2 3 1 2 3 1 2 3 1 2 3 1 2 3 //// SuperLight 8 Sep 2009 14:36 Test #4 is something like this: 2 5 1 answer: 1 2 1 1 1 1 Ans Test #6: 2 2 6 answer: 2 2 2 1 2 1 2 2 Edited by author 28.04.2010 14:40 Test 4 is something like this: (I fixed this when had WA4 and got WA26) 3 1 1 3 ------- 3 1 3 2 3 Edited by author 09.02.2011 23:51 AC now :) Edited by author 28.05.2011 17:05 |
Weak tests | Fyodor Menshikov | 1604. Country of Fools | 25 Oct 2010 12:34 | 3 |
My AC solution for test 3 1 3 1 answers 2 1 2 2 3 while better answer is 2 1 2 3 2 |
WA 2 What is test 2? | xurshid_n | 1604. Country of Fools | 15 Jun 2009 16:01 | 1 |
|
help WA3 | ACM.Krupko_Victor[Ivanovo SPU] | 1604. Country of Fools | 16 May 2008 03:04 | 1 |
help WA3 ACM.Krupko_Victor[Ivanovo SPU] 16 May 2008 03:04 program Project2; {$APPTYPE CONSOLE} uses SysUtils; var a,b:array[1..10001] of integer; t,i,n,t1,t2,j:longint; begin { assign(input,'d:\input.txt'); reset(input); assign(output,'d:\output.txt'); rewrite(output);} readln(n); if n=1 then begin write(1); exit; end; for i:=1 to n do begin read(a[i]); b[i]:=i; end; for i:=1 to n-1 do for j:=i+1 to n do if a[i]<a[j] then begin a[i]:=a[i]+a[j]; a[j]:=a[i]-a[j]; a[i]:=a[i]-a[j]; b[i]:=b[i]+b[j]; b[j]:=b[i]-b[j]; b[i]:=b[i]-b[j]; end; t:=-1; a[n+1]:=-1; repeat if (t<>b[1]) and (a[1]<>0) then begin t:=b[1]; a[1]:=a[1]-1; end else if (t<>b[2]) and (a[2]<>0) then begin t:=b[2]; a[2]:=a[2]-1; end; i:=1; while a[i]<a[i+1] do begin j:=i+1; a[i]:=a[i]+a[j]; a[j]:=a[i]-a[j]; a[i]:=a[i]-a[j]; b[i]:=b[i]+b[j]; b[j]:=b[i]-b[j]; b[i]:=b[i]-b[j]; i:=i+1; end; i:=2; while a[i]<a[i+1] do begin j:=i+1; a[i]:=a[i]+a[j]; a[j]:=a[i]-a[j]; a[i]:=a[i]-a[j]; b[i]:=b[i]+b[j]; b[j]:=b[i]-b[j]; b[i]:=b[i]-b[j]; i:=i+1; end; write(t,' '); until (a[2]=0); if t<>b[1] then write(b[1]); { sleep(112121);} { close(input); close(output); } end. give me wrong test, please! |