| Show all threads Hide all threads Show all messages Hide all messages |
| Please add full graph 100x100 | Denis Koshman | 1569. Networking the “Iset” | 14 Aug 2008 14:09 | 1 |
Well, may it's there... but I managed to get 0.14 sec AC with O(N^2*M/2). |
| If you have WA16 | Denis Koshman | 1163. Chapaev | 14 Aug 2008 11:28 | 1 |
First of all, precision of 1e-8 is ok to get AC (with double type and without trigonometry). Now about WA16 - that's the case when one of boundary rays is parallel to OX. When some angular segments crosses OX, I perform a split at 0/2PI point. In described case it was possible that I first delete a draught at point 0 and then add it. So, sorting should be not just angular, but also additions should precede deletions. This condition is automatic for regular cases, so I omitted it. But in described case special care should be taken. |
| Is greedy method ok or not? Is it nessary to make full search? | Nazarov Denis (nsc2001@rambler.ru) | 1163. Chapaev | 13 Aug 2008 23:30 | 5 |
I think that it is DP-problem We consider 2^16 states from 0 to final=2^16-1 Before we make precalculation finding for each draught finite possible moves just as adjacent to some another draught and bisectors between adjacent rays Anywhere we must use eps≈0.0000001 as precision level. Having found all possible moves we can easy reduce state k to states with few value because one move make number of draughts smaller. Finding all possibilities we must consider adjacent rays to draughts with the same color as now active draught. Edited by author 27.06.2007 13:46 I think, it is impolite to explain solutions of good problems here in forum. Of course, greedy algo doesn't work here... This is an old problem and beginers need clear plan before starting to solve. I agree with svr. Things required to solve this problem are quite conceptual, so it's ok to tell them in the forum. |
| Please, help to find mistake in task№1263 | practicant | | 13 Aug 2008 19:37 | 1 |
Помогите найти ошибку в задании №1263. Я использовал язык Си. Код программы: #include <stdio.h> void main() { int N,M,i,j,a[10000]; double p; vv: scanf("%d",&N); scanf("%d",&M); if (N<=0 || N>10000 || M<=0 || M>10000) goto vv; { for (i=0; i<M; i++) { scanf("%d",&a[i]); } for (j=1;j<=N;j++) { p=0.0; for (i=0;i<M;i++) { if(a[i]==j) { p=p+1; } } p=p/M*100; printf("%.2f%\n",p); } } } |
| Please, help to find mistake in task№1263 | practicant | | 13 Aug 2008 19:34 | 1 |
I used 'C'language. Following code(task№1263): #include <stdio.h> void main() { int N,M,i,j,a[10000]; double p; vv: scanf("%d",&N); scanf("%d",&M); if (N<=0 || N>10000 || M<=0 || M>10000) goto vv; { for (i=0;i<M;i++) { scanf("%d",&a[i]); } for (j=1;j<=N;j++) { p=0.0; for (i=0;i<M;i++) { if(a[i]==j) { p=p+1; } } p=p/M*100; printf("%.2f%\n",p); } } } |
| WA26 | Divan | 1587. Flying Pig | 13 Aug 2008 18:11 | 1 |
WA26 Divan 13 Aug 2008 18:11 |
| Why my program got WA? | Aleksey S.S. | 1247. Check a Sequence | 13 Aug 2008 14:19 | 7 |
var sum,s,n,i,j,k:longint; a:array[1..100]of longint; begin read(s,n); for i:=1 to s do read(a[i]); for j:=1 to s do for i:=1 to j do begin sum:=0; for k:=i to j do sum:=sum+a[k]; if sum>j-i+n+1 then begin write('NO'); exit; end; end; write('Yes'); end. Think about simpler solution -> without array - just O(n) !! I got AC without any array! ) var sum,s,n,i,j,k:longint; a:array[1..30000]of longint; begin read(s,n); for i:=1 to s do read(a[i]); for j:=1 to s do for i:=1 to j do begin sum:=0; for k:=i to j do sum:=sum+a[k]; if sum>j-i+n+1 then begin write('NO'); exit; end; end; write('YES'); end. var sum,s,n,i,j,k:longint; a:array[1..30000]of longint; begin read(s,n); for i:=1 to s do read(a[i]); for j:=1 to s do for i:=1 to j do begin sum:=0; for k:=i to j do sum:=sum+a[k]; if sum>j-i+n+1 then begin write('NO'); exit; end; end; write('YES'); end. use for i:=1 to s do for j:=i to s do begin .... end; {1<=i<=j<=s} |
| A hint for confused solvers. | 198808xc | 1130. Nikifor's Walk | 13 Aug 2008 11:43 | 1 |
Many people above have solved this problem, but they didn't express their thought well. The key is this: For ANY 3 vectors in the set with module not exceeed L, we can ALWAYS choose 2 of them and, with choosing the direction, make the module of their sum not exceed L. (this can be proved by geometry) So, we choose the two and reduce them to one (simply adding them and record the direction). Thus, we can reduce the amount of vectors by this until there are only TWO. At last, for any two vectors which has the module not longer than L, we can make the module of their sum not exceed L*sqrt(2). And that's all the key. What's left is to find a way to programme. Use tree to store the father-son relation is a good choice. Maybe it will help you, maybe not for my poor English. |
| 1499 | svr | 1499. Kerchiefs | 13 Aug 2008 05:55 | 3 |
1499 svr 19 Oct 2006 00:59 How many structures need quick solution. I worked with segments [i,j] on [1,N] and used 1: short num[50000] for quicksort of segments; 2: short prev[50000] for fathes of segments. Segment I is father of segment J if I smallest segment containing J. 3: vector<short>sons[50000] for sons of segments. Last structure very slow and I had bad Ac time 0.95. Re: 1499 Denis Koshman 13 Aug 2008 05:55 Edited by author 13.08.2008 06:08 |
| Eler circuit | svr | 1441. From the History of Gringotts Bank | 13 Aug 2008 05:05 | 3 |
How do this faster? 1) Adding virtual edges to pairs of vertices with odd degree 2) Building Eler circuit in new graph. 3) Cutting circuit by virtual edges. But Graph is undirected and when we removing edges in classic stac algorithm we should use set-class as dynamic Adj list for each vertex instead of vector-class How to do it even faster: add virtual edges between new virtual point and odd-degree nodes. Just O(N) overhead. (AC in 0.046 sec) Edited by author 13.08.2008 05:28 As for bidirectionality - just add edges twice and maintain bidirectional indexation between them. Or add all edges to base-0 arraay in the order (v1;v2), (v2;v1), (v3;v4), (v4;v3), etc... then "x XOR 1" will be index of backwards edge. |
| can any one who solved this problem help me? | Fechete Dan Ionut[dany] | 1187. Statistical Trouble | 13 Aug 2008 04:08 | 2 |
my program gives the same output file as th oficial ones but goth WA any tricks about end of line or something? Try to swap questions in cross-table queries. This way you will check that "-" are reported correctly in columns. |
| Give please any hints, how to solve this problem. I get TLE(16) | Tratata (barssimfi@mail.ru) | 1310. ACM Diagnostics | 13 Aug 2008 02:54 | 2 |
DP on Amount x Remainder (100x50), then continusously subtract calculated amounts with 1... 2... 3... from given index. Once it becomes strictly less than current number - proceed deeper for the next value. |
| I get WA on test 16 | Alexandru Popa | 1310. ACM Diagnostics | 13 Aug 2008 02:51 | 2 |
What is wrong with this test ? I had WA17, but that was too few reserved digits. |
| How big is N for test 16 ? | Alexandru Popa | 1310. ACM Diagnostics | 13 Aug 2008 02:51 | 4 |
N is much smaller than 50^100. 50^100 - is the number of all possible states, but N is the order of all ALLOWABLE states (whose sum mod K = 0 )and that's quite less, but still does not fit even in int64 :(. Wherefore, you have to use long arifmetics. If K=1, you'll get your 50^100 :) |
| What kind of tests were added? I have WA#17, but USACO works! | Alexey | 1147. Shaping Regions | 12 Aug 2008 23:40 | 2 |
Help! Thanks. Edited by author 09.06.2006 18:06 I had WA7 with some old stupid solution which ran through all previous rects and split them apart. Just rewrote it with N^2*log(N) and got AC. I think that 17th test just produces too many pieces for that straight algo to work. |
| Input ranges | nordom | 1147. Shaping Regions | 12 Aug 2008 23:39 | 2 |
It seems like the limits for input values given in problem statement are incorrect - after changing data types from short int (which have max value larger than 30000) to int I got AC for test cases 2..16 - in opposite to the version before this change. So the WA was caused by numbers at input larger than 30000 - it shouldn't happen. Am I wrong or should it be fixed? What about product of these numbers? |
| I know right n*n*logn solution. But how solve this problem faster? | Grebnov Ilya[Ivanovo SPU] | 1147. Shaping Regions | 12 Aug 2008 23:37 | 5 |
I tried Quadro and RD Trees and others complicated structures, but failed How it can be? With such various methods author has TLE, I got AC 0.9c with O(N*N*lgn) and interval tree but many authors have 0.001c AC on the same tests? I scan per-row, tracking topmos rectangle in a heap. X coordinates can be sorted only once (then just skip rectangles outside of the current slice) - this improved time from 0.75 sec to 0.28 sec Edited by author 12.08.2008 23:37 I use O(n*n*logn)to AC, too. And my algo can improve to O(nlogn). I make y coordinate as an Interval tree. In my O(n*n*logn) algo,Insert the interval into the tree when x coordinate is different is independent,so it need n time for searching in different x. In fact, the x coordinate which is nearby may be dependent,so we don't have to insert some intervals once more. There are O(n) intervals, each of them just inserts and deletes one time,so it is total up to O(nlogn). Sorry for my bad English. |
| Some Test | TestT | 1165. Subnumber | 12 Aug 2008 22:54 | 4 |
Test 1 : 101 Ans : 10 Test 2 : 123 Ans : 1 Test 3 : 7 Ans : 7 Test 4 : 91 Ans : 9 Test 5 : 9100 Ans : 189 Test 6 : 21 Ans : 15 Test 7 : 231 Ans : 260 Test 8 : 9100101 Ans : 189 Test 9 : 000612300000 Ans : 995888949 Test 10 : 78910111 Ans : 7 Test 11 : 698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110 Ans : 2850 Test 12 : 0999100 Ans : 35287 Test 13 : 1111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111011111111 Ans : 919111111111111111111111111111111111111111111111111111111111111111111111111111111111111111104 Test 14 : 566666 Ans : 1887 Test 15 : 1 Ans : 1 Test 16 : 0 Ans : 11 Test 17 : 0000000 Ans : 68888891 Test 18 : 09 Ans : 171 Test 19 : 999 Ans : 2588 Test 20 : 9919 Ans : 2863 Test 21 : 0202 Ans : 6971 Test 22 : 0202020202020202020 Ans : 2313131313131 Test 23 : 00070007000700070007 Ans : 8289728972891 Test 24 : 9999999999999939999999999 Ans : 14888888888888785 Test 25 : 1 5 len=100 Ans : Test 26 : 4 len=100 Ans : Test 27 : 0 len=200 Ans : Test 28 : 0 6 len=100 Ans : Test 29 : 9 len=200 Ans : Test 30 : 9 9 len=100 Ans : Test 31 : 3 len=84 Ans : Test 32 : 7 8 len=100 Ans : Test 33 : 5 len=100 Ans : Test 34 : Ans : Test 35 : Ans : Test 36 : Ans : Test 37 : Ans : Test 38 : 13206252123724040484317964602881252884069781203380530661996711969 2 len=100 Ans : Test 39 : 2226671115560004449333778222667111556000 len=100 Ans : Test 40 : Ans : 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 19988888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888891 99999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999 17988888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888888691 I'm very grateful, 'cuz I found what was WA13. The suspicious thing is that it was your 13th test as well :) Please sort them and remove numbering... or people might start sending tables. |
| K==20 at test #1 (+) | Test | 1500. Pass Licenses | 12 Aug 2008 19:53 | 3 |
K==20 at test #1 And the answer for this test is "2\n0 2", as in the sample Is this test correct? Edited by author 15.02.2007 00:05 You are right. If K would be 20 for the sample test, then the answer will remain the same. I keep receiving WA1 here. Is the 1 test like the sample (except for the K = 20) ? On my machine I'm getting answer as the sample's one |
| the statement is wrong | Alias aka Alexander Prudaev | | 12 Aug 2008 18:53 | 1 |
there is no need to start exam earlier, because both T1 and T3 are measured in munutes from the begining of exam, so if the exam starts earlier nothing changes. please, correct the statement. Edited by author 12.08.2008 18:54 |