Common BoardSubj I've been thinking on this problem for several days,but I still can't find such algorithm( Edited by author 05.03.2009 19:59 Just emulate the professor's operations using some precalculation... What is second test here? n=7 k=3 fence has more than 2n angles You are devilishly right! I figured it out when i drew a polygon of shape far from regular. But it incredibly complicates the solution :(( Not really.If I understand your algo correctly,than it only needs to be improved a little. Theoretically,my algo is O(n^3),but in tests my prog works less than 0,05 sec,because there're no such polygons,for which all the operations will be required. Edited by author 06.03.2009 02:14 Subj. PS Im sorry for my english. Same in Russian: Сколько раз Ник может ошибиться? My solution got AC but it fails following tests 5 5 5 1 2 3 4 5 1 1 1 1 1 1 1 1 5 1 2 3 4 5 5 4 5 1 2 3 4 5 1 1 1 2 2 1 2 5 1 2 3 4 5 What is your answers for this tests? I'm very interesting, what answer is rigth for test: 5 5 4 2 3 4 5 1 2 1 3 1 4 1 5 5 1 2 3 4 5 My program returns: 5 1 2 3 4 5 and get AC! But in this case professor get 4 target coin and paid 500 yen. So 125 yen for coin. It's srange :) Edited by moderator 01.03.2009 16:39 What is your answers for this tests? I'm very interesting, what answer is rigth for test: 5 5 4 2 3 4 5 1 2 1 3 1 4 1 5 5 1 2 3 4 5 My program returns: 5 1 2 3 4 5 and get AC! But in this case professor get 4 target coin and paid 500 yen. So 125 yen for coin. It's srange :) ######################## there are only 4 kind of needed coins in the sets => max answer is 4 and sets may be formed like 1 2 3 4 1 3 4 5 1 2 4 5 2 3 4 5 and so on any 4 sets are correct Edited by author 01.03.2009 22:29 Edited by author 01.03.2009 22:29 I'm sorry, my question wasn't clear :) What is your answers for yours tests? My program returned: 5 1 2 3 4 5 and 4 1 2 3 4 Is it right? Your tests are added. Problem will be rejudged soon. Edited by author 01.03.2009 16:40 My program returns wrong results on such a simple test 3 3 1 1 1 1 2 2 3 3 1 2 3 It returns result 2 coins and sets 1&3,instead of 3 1 2 3,but it still got AC yesterday. Edited by author 05.03.2009 19:54 I have Ac with wrong solution. My solution fails on 112 and other 4^k(8n+7) where k>=2 tests. What's the Duck????????????? Edited by moderator 06.10.2007 17:13 Darkwing Duck Edited by moderator 06.10.2007 17:12 If you have WA on test #6 pay attention on the: slashes are the part of the comment while line feed is not Why Crash (stack overflow)#8 ???? Help,please =) Use directive somelike #pragma comment(linker, "/STACK:16777216") This is described in the FAQ to this site. 2,3,5,7,13,17,19,31,61,89,107,127,521,607, 1279,2203,2281,3217,4253,4423,9689,9941, 11213,19937,21701,23209,44497,86243, 110503,132049,216091,756839,859433, 1257787,1398269,2976221,3021377,6972593, 13466917,20996011; Is it all right? Cuz I got WA... Help me. Yes the sequence is correct. I don't know what is wrong. There must be a problem with your code Const ... {sequence} Var n:array[1..40] of byte; t,i:byte; Begin Readln(t); For i:=1 to t do Readln(n[i]); For i:=1 to t do Writeln(a[n[i]]); END. I cann't believe it! I Have TLE#4! You hands is normal? :) I'm asking for help. What do you mean "hands". Try printing the output as soon as you read it. You don't know the exact limit for T. So your program behaves abnormally for T>40. Thank you! I got AC! Thanks. Please give me some test to figure out why WA8. I use KMP prefix function. Edited by author 03.03.2009 17:43 Edited by author 03.03.2009 17:52 #include <stdio.h> #include <stdlib.h> #include <math.h> /* * */ int main(int argc, char** argv) { /*dataseg*/ int N; int R; int i; float *x; float *y; float length = 0; double PI = 2.0*acos(0.0);
scanf("%d", &N); scanf("%d", &R); x = (float *) malloc(N * sizeof (float)); y = (float *) malloc(N * sizeof (float)); for (i = 0; i < N; i++) { scanf("%f", &x[i]); scanf("%f", &y[i]); } for (i = 0; i < N - 1; i++) { length += sqrt(pow(x[i + 1] - x[i], 2) + pow(y[i + 1] - y[i], 2)); } length += sqrt(pow(x[N - 1] - x[0], 2) + pow(y[N - 1] - y[0], 2)); length += 2 * PI * R; printf("%.2f", length); free(x); free(y); return (0); } Maybe because R must be real, not integer. My algorithm is to find the convex hull until the numbers of the point on the convex hull is less than 3. Could anyone tell me what's wrong?or give me some useful test case? I use such an algorithm:I take four normal vectors to four different surfaces of the "ship" as cross product of two vectors,which I take as two vectors between points creating these surfaces.The length of this vector is 2xsquare of the triangle created by these points. Then,as energy produced by one surface of the "ship" for one star can be counted as square(sq further) of the surface multiplied by length of the "star" vector and multiplied by absolute of cos between normal vector to the surface and "star" vector. abs of that cosinus is equal to abs of their scalar production divided by their length production.As sq*"star" vector length multiplied by 2 is equal to their length production,then the energy produced by one surface is equal to abs of their scalar production divided by 2.It's quite clear that if we sum energies produced by all surfaces we'll get 2x energy that's really got from this star,so we don't need to multiply it by 2 lately to get the power wished by "man in black".So,if we sum energies from all the stars we'll get resulting energy. I have checked and rechecked this algorithm several times,I also have rechecked the program several times,but I Haven't found any mistakes not in the program,nor in the algorithm,I also ran several tests and checked the results manually,so I'll be grateful to anyone who'll show me possible mistakes. Edited by author 01.03.2009 21:35 To find answer we realy need to find sum of all scalar products of normals and star vectors (its absolute values of course), then divide 2 and print out... I did it with long long - not int and not double I replaced int by long long and got the right result^_^ I have thought,for some reason,that int type'd be enough for summary power. for test "50 500" my program answer is "854559745684320697549060368131279814466643179689928095831053239604130293492672614469791533133321" test "50 450" my program answer is "3834688188199309756675466732967588185862422492337212276545580039517258085033387305291001857619600" So i think my program is right,Why got WA on Test#12? OK I got AC My HugeInt class has some bug! Today in TC was similar problem and my solution was failed. I submit my code here and get AC. I think tests is weak. My program fail on: 900 000 000 My answer: 710123457 808888890 718888890 709888890 708988890 708898890 708889890 708888990 708888900 708888891 Edited by author 01.03.2009 16:27 I surrender. What can be wrong with this code? [code deleted] Sorry for posting code. Please help! Edited by author 05.11.2005 20:58 Edited by moderator 22.02.2006 22:12 try this: abc ab ac def The answer is: 6 Other test (my program failed it): 2 3 4 The answer is: 0 One more test: a b c de f g hi The answer is: 5 Thank you for tests. My program outputs '6' in the last one and right answers in others. I fixed it, but it still WA #12 :-((( I can't understand what test can it be. What does the problem mean.How to know the answer? try this: abc ab ac def The answer is: 6 Other test (my program failed it): 2 3 4 The answer is: 0 One more test: a b c de f g hi The answer is: 5 Please, repair problem description(russian)! Admins, hello! Please, repair description, а то половина на русском, половина на английском. I got WA on 1 test. On sample input my program gives this answer 0.000000000 0.000000000 0.000000000 -30.000000000 25.980762114 15.000000000 -25.980762114 15.000000000 -2.886751346 -5.000000000 2.886751346 -5.000000000 is it true? Really What's wrong? Edited by author 02.03.2009 18:13 Edited by author 02.03.2009 18:13 Fist 3 points must be outside of triangle, next 3- inside. Yes, I fixed this bug. But now WA3.. In sample 1, the input data is abracadabra abrabracada and the sample answer is No abr abracad a Does the answer No abr abracada acceptable? abracada is also a prefix of abracadabra |
|