| Show all threads Hide all threads Show all messages Hide all messages |
| TLE test 70 | test_tset | 1394. Ships. Version 2 | 30 Mar 2014 15:57 | 2 |
I think this is a very hard case,and I don't know how to pass it.... can anyone give me some hint on this case? |
| [Help] Crash #4 ( Access Violation ) | Nguyen Khac Tung | 1069. Prufer Code | 30 Mar 2014 08:52 | 4 |
- Do you know test 4 ? - Any helpful tests ? - If not, please pick bugs from my code. My algo: Find minimal, adjacent list, output sorted list. Tks a loooottttttt Program Prufer_Code; Type pnode = ^node; node = Record data:Longint; next:pnode; End; Var adjList:Array[0..7500] of pnode; temp:pnode; A,C,minS:Array[0..7500] of Longint; n,i,j,s,p,q,m:Longint; fi:Text; Procedure add(k:Longint;var x:pnode); Var y,z:pnode; Begin If (x=nil) then Begin new(x); x^.data:=k; End Else Begin new(y); y^.data:=k; y^.next:=x; x:=y; End; End; Begin n:=0; While not seekeof do Begin inc(n); Read(A[n]); End; For i:=1 to n+1 do Begin inc(C[i]); inc(C[A[i]]); End; dec(C[A[n+1]],2); p:=0; For i:=1 to n+1 do If C[i]=1 then Begin inc(p); minS[p]:=i; End; For i:=1 to n do Begin q:=minS[1]; m:=1; For j:=2 to p do If minS[j]<q then Begin q:=minS[j]; m:=j; End; j:=q; minS[m]:=99999; add(j,adjList[A[i]]); add(A[i],adjList[j]); dec(C[A[i]]); If C[A[i]]=1 then Begin inc(p); minS[p]:=A[i]; End; End; For i:=1 to n+1 do Begin FillChar(C,sizeof(C),0); temp:=adjList[i]; p:=0; while temp<>nil do Begin inc(C[temp^.data]); temp:=temp^.next; End; Write(i,': '); For j:=1 to 7500 do If C[j]=1 then Write(j,' '); Writeln; End; End. I receive Access violation it test 4 too. :( Do anyone know the test? test 4 BaJIuK 4 Nov 2011 22:30 I was crashed on this test, because i forget to fill inf in cells of heap, before i start to solve. Also you can try this test: input: 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 output: is obvious Are you store the double edge but didn't double the edge memory? |
| cin/cout faster than scanf | ASK | 1990. Podracing | 30 Mar 2014 03:20 | 1 |
cin/cout with cin.sync_with_stdio(false) is 0.25 s, while scanf/printf 0.375 s. |
| Please share your solution with me | melkiy | 1003. Parity | 29 Mar 2014 23:17 | 6 |
Please, who solved this problem with disjoint sets send me your solution to the e-mail which is in my profile. I wrote the code and it gives right answers on many tests, but not passes here. I need to compare where an error is. Thanks to all, no need anymore. I AC. For those who has not overcame the problem, i repeat (based on all of the advices i've read here) breafly where you may be wrong 1) if b>length, the friend lies 2) number of questions can be wrong. I read line by line and analyze if there is only one "word" or three. So, to determine where the next test begins i do NOT do like for(i=0; i<answers; ++i) but like while(scanf("%d%d%s",&a,&b,&oddeven) == 3) But so you all will receive 2 words from next lines, except for last ones. icanwin, of course i would. But if to be more precisely i do like this: gets(buf); if(sscanf(buf, "%d%d%s", &a, &b, oddeven) == 1) { if a == -1 then the end of input else a new test begins } can you please share your solutions with me could you please share your solutions with us? |
| Simple problem | Vladislav | 1320. Graph Decomposition | 29 Mar 2014 23:00 | 1 |
It's very simple problem because all connected graphs which containes even number of edges can be divided into pairs of edges, which includes one common vertex!!!(and all connected graphs with odd number of edges can't be divided in such way) |
| Fractional part detection | bsu.mmf.team | 1942. Attack at the Orbit | 28 Mar 2014 21:54 | 4 |
I used this code: double x, y; cin >> x >> y; x *= 1000; y *= 1000; int X = (int)x, Y = (int)y; But this code doesn't work properly. For example, if x = -1.001, then X will be -1000 (in some cases one unit is lost). How to avoid this in C++? To solve this problem I had to read whole string and then parse it :) My method got AC: cin >> a; A = (int)(a*1000.000001); I use (g++11) double a; scanf("%lf",&a); p[j] = (int(a*1000.000001) + 100000) % 1000; "a*1000" gives WA "cin >> a" gives TL45 even with "cin.sync_with_stdio(false)" This task use some architectural float issues. So we need minimize to use real numbers. I try many times, but get AC only with manual parsing: x,y = sys.stdin.readline().strip().split() xs,ys = x.split('.'), y.split('.') x = int(xs[1]), y = int(ys[1]) if xs[0][0]=='-': x=-x if ys[0][0]=='-': y=-y I use float number only one time - in last line, in sqrt. |
| I want to find my code problem . help me!!!. | master amir | 1001. Reverse Root | 28 Mar 2014 19:47 | 2 |
#include<iostream> #include<stdio.h> int main(void){ double a; int i = -1; double NUM [100000]; while(EOF != scanf("%lf", &a)){ NUM[++i] = sqrt(a); } i--; while(i>=0){ printf("%.4f\n",NUM[i]); i--; } return 0; } Have you less a header file <math.h>? |
| Different Solution | Jobed | 1209. 1, 10, 100, 1000... | 28 Mar 2014 15:47 | 1 |
long n=2*(value-1); long sqr=(long) Math.floor(Math.sqrt(n)); if((sqr*(sqr+1))==n) print(1); else print(0); Edited by author 28.03.2014 15:49 |
| No subject | david | 1654. Cipher Message | 28 Mar 2014 11:14 | 1 |
Edited by author 28.03.2014 12:04 |
| Is this a valid test case? | Ade [FDU] | 1369. Cockroach Race | 28 Mar 2014 03:36 | 2 |
Is this a valid test case? 2 -9999 -1 -9999 1.00000000000000000001 1 9999 0 I know the answer should be 1. But it's hard to code. Edited by author 08.03.2014 14:22 My AC program answers 1 2 I don't think doubles allow such precision. |
| no subject | Даниил | 1837. Isenbaev's Number | 28 Mar 2014 02:12 | 1 |
Edited by author 28.03.2014 23:31 |
| good idea !!! | AlisheR Tojiev [☆UZB★TUIT☆] | 1706. Cipher Message 2 | 28 Mar 2014 01:18 | 3 |
aabaaab => { 0 1 0 1 2 3 } a 0 aa 1 aab 0 aaba 1 aabaa 2 aabaab 3 abcabcd a 0 ab 0 abc 0 abca 1 abcab 2 abcabc 3 abcabcd 0 0 0 0 1 2 3 0 |
| BFS or DFS | coolfishchen | 1002. Phone Numbers | 27 Mar 2014 23:49 | 10 |
When I used BFS,I found it would exceed the time limit. Does DFS also will exceed the time limit? BFS got AC. I had AC, when use BFS, I dont know, why you got TL... Maybe your progrm is incrorrect, because BFS really got AC! If BFS got AC, tests for this problem is extremely weak... you are wrong: we can construct graph with n = 100 verticles and BFS solve it in O(n^2) no, DFS is bad for this problem: we must compute the shortest sequence of words so DFS can work as slow as backtracking, exponential time Maybe you're right but I ment DFS with some changes) I also do DFS and got Time Limit on test 6 |
| hint | ASK | 1776. Anniversary Firework | 27 Mar 2014 23:03 | 1 |
hint ASK 27 Mar 2014 23:03 Use probability P(i,j) that a line with i rockets is finished after at most j salvos. The probability that it ends after exactly k+1 salvos is P(i,k+1)-P(i,k) = 1/i sum_l P(l,k) * P(r,k) - P(l,k-1) * P(r,k-1), where l is the index of the first launched rocket and thus the size of the left part and r is the size of the right part (r=i-1-l) of the line. The output is with cout << setprecision(12) << s*10 << endl; Edited by author 27.03.2014 23:04 |
| For Admin.... Please check Test 10. | Adham (TWYT Union) | 1440. Training Schedule | 27 Mar 2014 16:05 | 1 |
I think my program is correct but i have not accepted yet. why wrong answer #10.. please give me Test 10. |
| wa21 | Misha | 1785. Lost in Localization | 27 Mar 2014 12:42 | 4 |
wa21 Misha 20 Aug 2013 11:59 if a in [1..4] then write('few'); if a in [5..9] then write('several'); if a in [10..19] then write('pack'); if a in [20..49] then write('lots'); if a in [50..99] then write('horde'); if a in [100..249] then write('throng'); if a in [250..499] then write('swarm'); if a in [500..999] then write('zounds'); if a > 999 then write('legion'); Got same problem and my program is identical, have you found what the issue is ? Re: wa21 Mescheryakov_Kirill 27 Mar 2014 12:42 Try through a "case" case of a 1..4:write('few'); 5..9:write('several'); ... 1000 2000..:write('legion'); end; end. |
| Can the words be repeated in the output?? | Rosandra | 1002. Phone Numbers | 27 Mar 2014 01:18 | 4 |
Maybe that is what i am doing wrong. If i have a set of words, say: it your reality real our Can the output be something like: reality our reality or the words can't be repeated?? I think it is depend on telephone number and on condition of problem :) Ya, they can. I've also misunderstood the task firstly. Otherwise, it is damn hard. |
| WA3 | I.Smirn0ff | 1590. Bacon’s Cipher | 26 Mar 2014 22:13 | 2 |
WA3 I.Smirn0ff 26 Mar 2014 20:48 Please give me some tests. Re: WA3 I.Smirn0ff 26 Mar 2014 22:13 I found a bug in the code, i wrote wrong z-function. Test aaabaaaab correct answer is 29 |
| к жюри | xMagGTU Дмитрий Тишкин GPRS | 1533. Fat Hobbits | 26 Mar 2014 01:54 | 9 |
к жюри xMagGTU Дмитрий Тишкин GPRS 3 Mar 2007 14:00 перепроверте тесты задачи B pls чё за xMagGTU Дмитрий Тишкин GPRS 5 Mar 2007 00:00 исходя из условий задачи необходимо вывести номера хобитов(строк) состоящих из одних нулей предворив список на отдельной строке числом таких строк засада при случае когда таких строк нет( возможен когда матрица содержит ошибочные данные тк как всегда должен имется легчайший хобит) ВОПРОС почему так мало ac? у такой на первый взгляд простой задачи? намекните pls! not so easy, try this test: 3 0 0 0 1 0 0 1 0 0 answer: 2 2 3 or this: 3 0 0 0 0 0 0 1 1 0 answer: 2 1 2 По-моему так это NP-полная задача на 100 узлов Edited by author 16.09.2010 19:25 Эта задача решается за O(n^2) + Кун. Так что совсем быстро :) |
| Wrong test? | Nodir NAZAROV Komilijonovich [TUIT-Karshi] | 1440. Training Schedule | 25 Mar 2014 23:08 | 1 |
Wrong test? Nodir NAZAROV Komilijonovich [TUIT-Karshi] 25 Mar 2014 23:08 I think there can be several correct answers, and not all of them are accepted. Is order of days important (Monday, Wednesday, Saturday == Saturday, Monday, Wednesday)? For 3rd test my program prints "Monday, Tuesday, Wednesday" which gives 14 days. Why I got WA#3? Thanks |