| Show all threads Hide all threads Show all messages Hide all messages |
| 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; } |
| 1086 | Strevg | | 14 Oct 2010 22:40 | 1 |
1086 Strevg 14 Oct 2010 22:40 |
| About time limit | Evgeniy++ | 1007. Code Words | 14 Oct 2010 20:53 | 1 |
I had ACed with about 1.6 sec running time! I guess the tests for this problem are not strict enought, because I have used very poor O(n^2) algorithm here. |
| Brilliant problem | [Ural SU] GetTester | 1396. Maximum. Version 2 | 14 Oct 2010 14:37 | 1 |
I received incomparable pleasure of solving this problem. Vladimir, Thanx. :) |
| Weak Test Cases | Pooya Zafar | 1774. Barber of the Army of Mages | 14 Oct 2010 11:05 | 2 |
Hi admins I have a greedy algorithm that is completely wrong but when I submited it gave AC and so I think that your test cases are too weak. a simple test case that my code is wrong for that is: 4 1 1 2 3 2 1 6 5 4 Correct Answer: but my code answer is: No Please check your test cases. Thanks in advance |
| I have AC in (0.093) | Yusupov Azat(UB of TUIT) | 1375. Bill Clevers | 14 Oct 2010 10:45 | 1 |
while (true) { int d = (int)Math.sqrt(kk); if (d*d==kk) { System.out.println(0+" "+d); return; } else { long d3 = kk-d*d; int dd = (int)Math.sqrt(d3); if (dd*dd==d3) { System.out.println(dd+" "+d); return; } } kk += p; } |
| Why answer for N=5??? | VsR | 1779. The Great Team | 14 Oct 2010 02:21 | 4 |
thank you but my program solution for N=5 (Accepted) 6 1 2 1 3 2 3 2 4 3 4 3 5 Сорри англ хромает, УСЛОВИЕ ЗАДАЧИ нормальные составляйте а не байку из склепа в которой ничего не понятно! |
| for one who has wa9 | Ibragim Atadjanov (Tashkent U of IT) | 1779. The Great Team | 14 Oct 2010 01:10 | 1 |
I had wa9 many times. Then I decided to find this test and found, fixed my bug and ac. test 9 n = 18 good luck |
| How read unknown count of lines in C#? | Goncharov Evgeny | | 14 Oct 2010 00:06 | 1 |
I do this string temp; while (temp != "") { // do something temp = Console.ReadLine(); } I got the "Crash" if i send it. Is this problem can be solved? |
| Why TL12? Help me please | Man'ka_NN | 1542. Autocompletion | 13 Oct 2010 21:11 | 1 |
Edited by author 24.10.2010 21:58 |
| tests | Viktor | 1209. 1, 10, 100, 1000... | 13 Oct 2010 18:18 | 3 |
tests Viktor 6 Apr 2008 19:05 WA on test #3... i generate all solutions and still give me WA...:( Use long not int...Look at my code WA on test #3... i generate all solutions and still give me WA...:( |
| Test WA#3 | Quramboyev Akbar Shox! | 1190. Bar of Chocolate | 13 Oct 2010 17:47 | 2 |
Test WA#3 Quramboyev Akbar Shox! 13 Oct 2010 17:46 3 q 0 r 0 e 1 5 right ans:Yes Thank you! I got AC (0.125sec) |