Common Board| Show all threads Hide all threads Show all messages Hide all messages | | Simple Testcase | Alexander Georgiev | 1791. Uncle Styopa and Buses | 19 Oct 2010 00:08 | 1 | Be sure to pass the following testcase: 6 1 10 1 10 1 10 1 10 1 10 6 3 1 4 1 | | I am sure that there is no test in which we must output NO!!!! | Tigran92(Rau) | 1107. Warehouse Problem | 18 Oct 2010 23:38 | 1 | | | Whats wrong with my formula? | Dijkztra | 1142. Relations | 18 Oct 2010 18:12 | 3 | z = fact(z)/(2*pow(log(2),n+1)); if(fmod(z,1)>=0.5) z = floor(z) + 1; else z = floor(z); I tried the example test case and got true, but got WA with 1st test case... T_T I sent your formula and got AC. Try to output answer so: cout << fixed << setprecision(0) << z; or so: printf("%.0lf",z); And you must use double instead of float function g(x,k:longint):comp; var i:longint; q:comp; begin q:=1; for i:=1 to k do q:=q*i; g:=q*x; end; var f:array[0..20,0..20] of longint; a:array[0..20] of comp; i,j,n,k:longint; begin for i:=0 to 10 do begin f[i,1]:=1; f[i,i]:=1; end; f[0,1]:=0; for i:=1 to 10 do for j:=2 to i-1 do f[i,j]:=f[i-1,j-1]+f[i-1,j]*j; for i:=2 to 10 do for j:=1 to 10 do a[i]:=a[i]+g(f[i,j],j); readln(n); while n>0 do begin writeln(a[n]:0:0); readln(n); end; end. | | WA 13 | delin | 1786. Sandro's Biography | 18 Oct 2010 18:03 | 2 | WA 13 delin 17 Oct 2010 03:14 Re: WA 13 QAFQAZSehriyarNovruzov 18 Oct 2010 18:03 try this test jkhdSaFKrojkllSafkroppp answer 10 at first my answer is 20.I saw my bug with this test. you must find max the same letter with "Sandro" and max lowercase letter. Edited by author 18.10.2010 18:04 Edited by author 18.10.2010 18:04 Edited by author 18.10.2010 18:07 Edited by author 18.10.2010 18:08 | | WA 12 | okulov-nikolay | 1791. Uncle Styopa and Buses | 18 Oct 2010 13:37 | 1 | WA 12 okulov-nikolay 18 Oct 2010 13:37 | | How to write 0.001 solution | Nguyen Khac Tung | | 18 Oct 2010 08:03 | 5 | My best time for most programs is 0.015 at least. I see lots of 0.001s exec time . Can share how to write one ? Even the easiest problem A+B It was possible only in 2008 and earlier. Why so? More complicated tests were added? Admins can tell you. I think it's because hardware has been changed. | | No subject | Tudor Siminic | 1794. Masterpieces of World Architecture | 17 Oct 2010 17:24 | 1 | Can someone give me test 6? | | I use greedy method to choose loop in the order of DFS.But I've just found a peculiar test case that DFS will be incorrect.Is greedy method right here? | Huang Yizheng | 1077. Travelling Tours | 17 Oct 2010 13:10 | 4 | For example: 7 10 1 2 2 3 2 4 2 5 3 5 4 5 5 6 5 7 6 7 1 7 At first the DFS procedure find the loop: (1,2,3,5,6,7,1),then it'll find (1,2,3,5,7,1). and next,no loop with unused edge will be found!?! In fact,the maximum T is 3(it's obvious),but use greedy method + DFS the number of T only reach 2. Unless we regulated the order of search (it means DFS can't be right!),otherwise we have to delete a found loop to let more loop to have unused edge,then how to make the regulations? Sorry, for this example, the correct output is T = 4 !!! Check your algorithm again !!! mailto : trungduck@yahoo.com > For example: > 7 10 > 1 2 > 2 3 > 2 4 > 2 5 > 3 5 > 4 5 > 5 6 > 5 7 > 6 7 > 1 7 > At first the DFS procedure find the loop: > (1,2,3,5,6,7,1),then it'll find (1,2,3,5,7,1). > and next,no loop with unused edge will be found!?! > In fact,the maximum T is 3(it's obvious),but use greedy > method + DFS the number of T only reach 2. > Unless we regulated the order of search > (it means DFS can't be right!),otherwise we have to > delete a found loop to let more loop to have unused > edge,then how to make the regulations? > > Once DFS loop is found, it ALWAYS contains unused edge - e.g. the edge which looped it in :) Edited by author 17.10.2010 13:22 Edited by author 17.10.2010 13:22 | | WA10 | Sergey | 1038. Spell Checker | 17 Oct 2010 03:05 | 2 | WA10 Sergey 12 Mar 2010 20:09 Hello, i try send my programm but always get some WA. Can you explaint few things. First: In END of input ".?!"? When i added check for it i get 1WA. Second: "ssss[S]ssss" r there mistake? When i check for it i get 2WA Third: When i delete this conditions i get 10WA. Im confused. I've readed all threads and added conditions for every case which i found. What in 10 test? I guess the 10-th test checks for your attintive reading of the condition: "1. The first LETTER in a sentence is small." For example, the text "Hello! 238 my Friend" has an error, because the first letter in the second sentence is NOT the digit '2' but the letter 'm' which must be capital. | | Why I got WAЈїЈїЈїЈїЈїЈїЈї | qwt | 1126. Magnetic Storms | 17 Oct 2010 00:31 | 2 | var a:array[0..14000] of longint; b:array[-1..200000] of longint; n,i,j,k,max:longint; begin read(n); fillchar(a,sizeof(a),0);fillchar(b,sizeof(b),0); b[- 1]:=10000;max:=-1; for i:=0 to n-2 do begin read(a[i]); if a[i]=-1 then begin writeln(max);halt;end; inc(b[a[i]]); if a[i]>max then max:=a[i]; end; read(j); while j>=0 do begin inc(i); i:=i mod n; dec(b[a[i]]);a[i]:=j; inc(b[j]); if j>max then max:=j; while b[max]<=0 do dec(max); writeln(max); read(j); end; end. Because first chislo is m (don't n) Edited by author 17.10.2010 00:31 Edited by author 17.10.2010 00:31 | | to admins: when will the new problems be add to problemset(-) | Ibragim Atadjanov (Tashkent U of IT) | | 17 Oct 2010 00:08 | 2 | when will the new problems be add to problemset(-) | | I doubt if the ACed program is right | 198808xc | 1591. Abstract Thinking | 16 Oct 2010 21:10 | 4 | I have been thinking about the problem these days, and found that the solution is much related to the 4, 5 or 6-point groups of the N points. For the former two situations, we could simply calculate that the total number of the figures is 4 * C(n, 4) and 5 * C(n, 5) but what have we do when there are 6-point groups? According to the problem statement, the chords must intersect pairwise, so the solution for 6-point groups will be based on the detail position of the points. For example, we must find out if the chords will parallel with each other. On the other side, I found we have more than one ways to connect 6 points to form the figure. For those 6-point groups with no paralleling chords, we have actually 4 ways to connect them: (1-4, 2-5, 3-6), (1-4, 2-6, 3-5), (2-5, 1-3, 4-6) and (3-6, 1-5, 2-4). Here we numbered the points in CW or CCW order. Could anybody tell me that why the correct answer could be 4 * C(n, 4) + 5 * C(n, 5) + C(n, 6), (especially the last term) If my analysis above is right, this formula will be wrong even in N = 7. Thanks in advance. I think that's indeed the correct answer. For any 4-point group we have 4 combinations, and for any 5-point groups we have 5. So there are 4 * C(7 ,4) + 5 * C(7, 5) = 245. For any 6-point groups, as N = 7, we could know that it is a complete group for all 7 points with only one missing. So the 7 "different" groups are actually the same. Let's count how many interesting triangles in one group. For they are all the same, we take point 1, 2, 3, 4, 5, 6 on the circle, which is in CCW order (7 is missing). We have the following two ways to connect them and make them intersect pairwise: (1-4, 2-5, 3-6): a small triangle is formed inside the circle. and (1-3, 2-5, 4-6): a long triangle is formed, with 2 of its vertices inside the circle. So, there are 2 (or, at least 2) combinations for every 6-point groups in N = 7. So the total number will be 245 + 7 * 2 = 259 (or, at least 259). But all the ACed program will give the answer 252. Why? Where did I have a mistake? Anyone, please, tell me the truth about this problem. Thanks again in advance! 3 of your ways to connect 6 points are wrong: (1-4,2-6,3-5) - segments 2-6 and 3-5 don't intersect (2-5,1-3,4-6) - segments 1-3 and 4-6 don't intersect (3-6,1-5,2-4) - segments 1-5 and 2-4 don't intersect It is true, because any six different points construct a CONVEX 6-gon if they lie on one circle. Well, I suddenly realized that we should regard the CHORD as a SEGMENT, not a LINE. So the ACed programs are right. Thank you very much. | | wa 6 ? | teamsteam | 1794. Masterpieces of World Architecture | 16 Oct 2010 17:34 | 1 | wa 6 ? teamsteam 16 Oct 2010 17:34 | | No subject | Mandakhnaran | | 16 Oct 2010 16:29 | 1 | some one pls explain sandras biography plz | | No subject | Moscow SU Chapelnik (Shteiner, Panin) | 1790. Searching for the Truth | 16 Oct 2010 16:14 | 1 | No subject Moscow SU Chapelnik (Shteiner, Panin) 16 Oct 2010 16:14 We got CE for some reason while our compilers manage to run it. | | Передвижение | Tbilisi SU: Andrey Lutsenko | 1789. Searching for the Dodecahedron | 16 Oct 2010 15:03 | 2 | Для конкретного постамента, направление, куда переместится с него этот несчастный артефакт, заранее зафиксировано или он может с одного и того же постамента в одном и том же сценарии и направо ходить, и налево по своему желанию? Видимо, по своему желанию может ходить за исключением 1-го и n-ого постамента | | wa10??? | georgievbg | 1787. Turn for MEGA | 16 Oct 2010 14:49 | 2 | wa10??? georgievbg 16 Oct 2010 14:35 i have WA #6 can u give me some test? | | По условию | mastersobg | 1789. Searching for the Dodecahedron | 16 Oct 2010 14:36 | 2 | Может ли артефакт сдвинуться влево, когда стоит на 1-ом месте. Т.е. сдвиги цикличны? нет, это видно из примера | | WA#24 | Tigran92(Rau) | 1334. Checkers | 16 Oct 2010 01:30 | 1 | WA#24 Tigran92(Rau) 16 Oct 2010 01:30 WA#24 is the case,in which answer is Draw ! | | Question!!! | Promix17 | 1012. K-based Numbers. Version 2 | 16 Oct 2010 00:12 | 2 | What's wrong??? What's 6 WA??? Why??? My programm enables big numbers!!! Could you tell me some tests with right answers? #include<stdio.h> #include<stdlib.h> #include<conio.h> #include<string.h> char* add(char *p1, char *p2) { char *p; char temp=0, end1=0, end2=0; int len,i; len=strlen(p1)>strlen(p2)?strlen(p1)+2:strlen(p2)+2; p=(char *)malloc(len*sizeof(char)); for(i=0; i<len-1; ++i) { if(!p1[i]) end1=1; if(!p2[i]) end2=1; if(end1&&end2&&!temp) break; if(!end1) temp+=(p1[i]-'0'); if(!end2) temp+=(p2[i]-'0'); p[i]=temp%10+'0'; temp/=10; } p[i]=0; while(p[--i]=='0'&& &p[i]!=p) p[i]=0; return p; } char* sub(char *p1, char *p2) { char *p; char temp=0, end1=0, end2=0; int len,i; len=strlen(p1)>strlen(p2)?strlen(p1)+2:strlen(p2)+2; p=(char *)malloc(len*sizeof(char)); for(i=0; i<len-1; ++i) { if(!p1[i]) end1=1; if(!p2[i]) end2=1; if(end1&&end2&&!temp) break; if(!end1) temp+=(p1[i]-'0'); if(!end2) temp-=(p2[i]-'0'); p[i]=(temp+100)%10+'0'; if(temp<0) { temp/=10; temp--; } else temp=0; } p[i]=0; while(p[--i]=='0'&& &p[i]!=p) p[i]=0; return p; } char* mul(char *p1, int k) { char *p; char temp=0, end1=0; int len,i; len=strlen(p1)+2; p=(char *)malloc(len*sizeof(char)); if(k==10) { p[0]='0'; p[1]=0; strcat(p,p1); return p; } for(i=0; i<len-1; ++i) { if(!p1[i]) end1=1; if(end1&&!temp) break; if(!end1) temp+=(p1[i]-'0')*k; p[i]=temp%10+'0'; temp/=10; } p[i]=0; while(p[--i]=='0'&& &p[i]!=p) p[i]=0; return p; } void printb(char *p) { int i; for(i=strlen(p)-1;i>=0; i--) printf("%c", p[i]); } int main() { int N, K; int i; char* result, *t1, *t2; char* Nulls[2000];
printf("Enter N and K: "); scanf("%d%d",&N,&K);
Nulls[0]="0"; result=(char *)malloc(2*sizeof(char)); result[0]=K-1+'0'; result[1]=0; try { for(i=1; i<N;++i) { Nulls[i]=sub(result,Nulls[i-1]); t1=mul(Nulls[i],K); t2=mul(Nulls[i-1],(K-1)); result=add(t1,t2); free(t1); free(t2); } } catch(...) { printf("Error"); while(!kbhit()); return 0; } printf("Result = "); printb(result); free(result); while(!kbhit()); return 0; } |
|
|