Common Board| Show all threads Hide all threads Show all messages Hide all messages | | wa #9 (+) | AlMag(VNTU) | 1265. Mirror | 27 Oct 2011 18:55 | 8 | I have only ONE division and no sqrt's, no rotates! what's wrong? Try rewrite program on pascal with extended. I got wa9 on C++ too, but on pascal same algo got AC Edited by author 10.04.2009 12:56 ok, i'll try. but why? i used long double, is that correct? sizeof (long double)=sizeof (double) Try to swap(x1,x2) and swap(y1,y2). This change gave me AC. thanks, it's really weird..... | | may i use 'struct'??? | Tiraill | 1875. Angry Birds | 27 Oct 2011 15:02 | 2 | may i use 'struct' in my programm? Edited by author 25.10.2011 21:34 Yes! =) for example struct pointT{ double x, y; pointT(){ x = y = 0.0L;} pointT( double _x, double _y ){ x = _x; y = _y; } }; | | A little help from author | Michael Medvedev (KNU training center) | 1132. Square Root | 27 Oct 2011 06:05 | 19 | The solution is really hard enough - you must know the serious number theory :-) :-) :-) read a book Handbook of applied cryptography at http://cacr.math.uwaterloo.ca/hac/ Especcialy chapter 2 - mathematical background, and the solution to the problem is written in chapter 3 - subchapter about square root problem. Author I've read the pdf files, then write the program as the algorithm described in the file, and also "Time Limit Exceeded"! What must I pay attention for? > I've read the pdf files, then write the program as the > algorithm described in the file, and also "Time Limit > Exceeded"! > What must I pay attention for? 1. Power opreration x^n - O(log n) 2. Evaluate Legandre symbol based NOT on factorization, but in chapter 2 exist recursive algorithm (I havn't just the chapter, but I'll try to see and will tell the page) If some questions will arise, will try to answer. By the way, you can post me your solution to medv@rambler.ru and I will tell you the error (why time limit exceeded). Medvedev Michael > 2. Evaluate Legandre symbol based NOT on factorization, but > in chapter 2 exist recursive algorithm (I havn't just the > chapter, but I'll try to see and will tell the page) Hmm, Legandre for 2 numbers = 1 or -1 (-1 ~ n-1), right? If that is so, can i use Euler criteria? a^((n-1)/2)=(a/p) mod p where (a/p) - Legandre symbol. why don't you read the document posted by the author? The Important Hint: Use longint to calculate.Because it use O((logn)^3) bit-operations.Another one,you may use Euler criteria to calulate Legendre. The problem is really hard enough, but the test data is really easy enough. so the The solution is NOT really hard enough > > The problem is really hard enough, > but the test data is really easy enough. > so the The solution is NOT really hard enough > > Hello, free! What is your solution, send me please it to medv@rambler.ru I can for it send you my tests. You'll see that the tests are big and good enough. Author You know, I've realized algorithm "Zessenhaus-Kantor", but it writes Time-limit!!! This algorithm has O(log n). What is your algorithm? The solution is really hard enough - you must know the serious number theory :-) :-) :-) Simple deterministic method with complexity O(sqrt(N)) is described in "The Art Of Computer Programming" (exercise 5.25). It's just enough - my program accepted in 0.890 sec. (exercise 5.25)? I can't find it. Can you tell me at which volumn and page(although the verson may be different)? I am so interested in using search method to solve this problem... chapter 5 (without subindexes) - sorting, exercise 25, the last one before chapter 5.1 The link is broken now... Hi, I used the algorithm that is in the book you said, but I got TLE, can you help me? Do you speak about 3.34 algorithm from HAC book? How do you find quadratic non-residue modulo p? I didn't search it randomly and use precompiled array of pairs (prime, some_non-residue (mod p)). | | 2 Admins: "IMHO: Rejudgement is needed." | Lomir | 1096. Get the Right Route Plate! | 26 Oct 2011 23:00 | 7 | My AC probram gets on samle test output 2 2 1 However this is an output of reversed sequence. It is even imposible to change 1/8 to 5/4. Good output: 2 1 2 What is more, in the problem statement is not written that any one shortest way of changing can be printed. Even for sampe test there are 2 way of solving it. Sorry for mine English. Thank you for help! Validator of this problem was fixed. Rejudge is finished. 56 AC verdicts turned to WA, but 12 WA got AC. IMO, tests are still incorrect. My program got TLE #10 after such debug submit: // some code here ... int m; void TLE(){ while(1); } int main(){ scanf("%d ",&m); if(m > 1000) TLE(); int u,v,x,a,b; REP(i,m){ scanf("%d %d ",&u,&v); if(u <1 || u > 2000) TLE(); // some code here } // some code here return 0; } Without assertions it got Crash #10... You are right! There was a route number 0 in several tests. Tests are fixed. The wrong verdicts will be rejudged. My AC solution give wrong (I think so) answer on this test: 4 6 8 5 4 7 4 1 5 6 1 8 Answer: 1 1 But we cannot do it. Solution means that we give our plate "1 8" to the driver of the 1st bus and he gives us plate "6 8". But his route is 6 and he gets "1 8". So his plate now doesn't correspond to its route. In statement is said "Any driver will agree to change his plate for another only if this plate has the number of his route". "1 8" doesn't have 6. Send me the code, please! goldenxbullet@gmail.com Thanks! | | WA1. What's wrong with the output? (Solved!) | Radiosterne | 1446. Sorting Hat | 26 Oct 2011 19:57 | 2 | The wrong line was: cout << endl << "Griffyndor:" << endl; Edited by author 26.10.2011 03:43 Edited by author 26.10.2011 19:58 Edited by author 26.10.2011 19:58 Solved! While solving this problem, pay attention to spelling of faculties ;-) | | test#26 | MoonRandom | 1027. D++ Again | 26 Oct 2011 15:40 | 1 | test#26 MoonRandom 26 Oct 2011 15:40 why test#26 ... what mean? | | what is it TEST3 | Daniel | 1877. Bicycle Codes | 26 Oct 2011 15:22 | 2 | i'm think test 3 incorrect. if use this method for read input data we got WA scanf("%s1 %s2",s1,s2); S1 = (s1[0]-'0')*1000 + (s1[1]-'0')*100 +(s1[2]-'0')*10 +(s1[3]-'0')*1; S2 = (s2[0]-'0')*1000 + (s2[1]-'0')*100 +(s2[2]-'0')*10 +(s2[3]-'0')*1; if use scanf("%d %d",&S1,&S2); we has CA | | Help, please! | Anuar | 1333. Genie Bomber 2 | 26 Oct 2011 15:15 | 1 | please, tell me how to solve this problem. I can't find right solution to this problem. | | This is problem 4103 / EPALIN on SPOJ | Nic Roets | 1354. Palindrome. Again Palindrome | 26 Oct 2011 05:58 | 2 | But the test data on SPOJ is wrong. Not really, you are allowed to add zero characters in spoj task, but here it's not allowed. | | >.< | Jordan Team | 1084. Goat in the Garden | 26 Oct 2011 02:01 | 1 | >.< Jordan Team 26 Oct 2011 02:01 please whate is the case # 4??????????? | | WA #2 ? | Uzbek boy | 1821. Biathlon | 26 Oct 2011 01:48 | 2 | WA #2 ? Uzbek boy 11 Oct 2011 03:25 please, give me any test for WA #2 WA#2 Siroj Matchanov [TUIT] 26 Oct 2011 01:48 I'm sick of it. Please explain it to me. I'm getting WA2. What am I doing wrong? This is my code: #include "stdio.h" #include "algorithm" #include "string.h" struct time { double s, os; //os - original time // s - finish time (+id*30) char name[21]; int I; time(const double S = 0, const int id = 0) :s(S), I(id) {} void inc(const int id) { os = s; s += 30*id; } }; int cmp(const void* a, const void* b) { return ( ((time*)a)->s > ((time*)b)->s ); } int cmp2(const void* a, const void* b) { return strcmp(((time*)a)->name, ((time*)b)->name); } int cmp3(const void* a, const void* b) { return ( ((time*)a)->os < ((time*)b)->os ); } int main() { int n; scanf("%d\n", &n); time* ts = new time[n+1]; time* ans = new time[n+1]; int m; float t; for(int i=0; i<n; i++) { scanf("%s %d:%f\n", ts[i].name, &m, &t ); ts[i].s = t + m * 60; ts[i].inc(i); } std::qsort(&ts[1], n-1, sizeof(time), cmp); int j=0; ans[j++] = ts[0]; for(int i=1; i<n; i++) { if( cmp3( &ts[i], &ans[j-1]) ) ans[j++] = ts[i]; } std::qsort(ans,j,sizeof(time),cmp2); printf("%d\n",j); for(int i=0;i<j;i++) printf("%s\n", ans[i].name); delete[] ans; delete[] ts; return 0; } Edited by author 26.10.2011 01:51 | | What`s wrong? | Lesnik_1 | 1068. Sum | 26 Oct 2011 01:34 | 1 | using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace _1068 { class Program { static void Main(string[] args) { int number = int.Parse(Console.ReadLine()); int result = 0; if (number > 10000 || number < -10000) throw new Exception("BAD!!!"); if (number > 0) for (int i = 1; i <= number; i++) { result += i; } if (number < 0) for (int i = 1; i >= number; i--) { result += i; } Console.WriteLine(result); } } } | | 2 admins - 2 | DK [Samara SAU] | 1768. Circular Strings | 26 Oct 2011 00:34 | 11 | your 8h test is incorrect, the answer is ALWAYS NO if n != 4 if u contact me, I'll give you the prove Why do you think so? Do you mean there is no n-gons for n != 4 ? :) Regular n-gons with n != 4 can't have all vertixes with rational coordinates. But it's said in the statement that coordinates are given with some accuracy, so I think it's ok. Not, all is not OK cause to program with absolute precision will fail with WA. there are some problems like this: 4 0 0 0 1 1 1 1 0 //YES, obviously 4 0 0.000009 0 1 1 1 1 0 //YES or incorrect test due to 10^-5 restriction?! 4 0 0.00000000000000000000000000009 0 1 1 1 1 0 //YES or incorrect test due to 10^-5 restriction?! In the statement you may see two numbers: 10^{-5}, 10^{-10} So about your tests: The first, you are right, is YES, obviously. The second does not exist (By the statement, there are no such tests in testset!) The third is same to the first. why is 10^{-10} a minimal guarantees for 'YES' answer? this is just input precision. Edited by author 12.04.2010 03:49 I think that statement need an additional guarantee like "It is guaranteed that in the case of the positive answer the coordinates of the points can be changed by less than 10^(−10) [or another magic constant from jury solution] so that they become the coordinates of vertices of a regular n-gon written in the traversal order" For example, test: 5 1 0.5 0.654508, 0.975528 0.0954915, 0.793893 0.0954915, 0.206107 0.654508, 0.0244717 The answer is "YES" !!! Try this interesting test: 4 0 0.333333 0.5 0.666667 1 0.333333 0.5 0 The answer is NO. Edited by author 18.04.2010 11:57 I think, that answer on this test: 4 0.0000199999 0.0000100000 0.0000000001 0.9999900000 0.9999999999 0.9999900000 0.9999800001 0.0000100000 is YES for example, the resulting points are 0.00001 0.00001 0.00001 0.99999 0.99999 0.99999 0.99999 0.00001 but my AC program answers NO And I still think that this problem is much more hard, that author thinks, because of different precisions in the statement. | | Please help !! c++ | Daniel | 1001. Reverse Root | 25 Oct 2011 22:33 | 2 | #include <iostream> #include <cmath> #include <iomanip> #include <stdio.h> using namespace std; int main() { int i=0; float A[256*1024/2]; do { cin>>A[i];
if ( A[i]>=0 && A[i]<= pow(float(10),18) ) { std::cout.precision(4); std::cout<<fixed<<sqrt(A[i]); } else
i++; } while(i<(256*1024/2)); return 0; } Edited by author 25.10.2011 15:16 | | WA#11 | 3a[3.141592..]Jlu | 1530. Ones and Zeroes | 25 Oct 2011 22:26 | 2 | WA#11 3a[3.141592..]Jlu 18 Jun 2009 03:18 I've got wa#11. But all test in forum my prog give right answers. Please give me more testcase. try this: 8 01100110 01100110 01100110 10000000 | | Wrong answer(please help with input array) | Dmitriy | 1001. Reverse Root | 25 Oct 2011 22:19 | 5 | Code: C/C++ #include <iostream> #include <math.h> #include <stdio.h> int main() { const int N=10000; double a[N]; long count=0,i; while (std::cin>>a[i]) { std::cin>>a[i]; count++;} printf("\n"); for(i=count-1;i>=0;i--) printf("%25.4lf\n",sqrt(a[i])); return 0; } Question:How to insert an array to provide input before the end of the border Please help, I`am beginner=( Thanks. 1. N can be maximum 131072 so adjust N accordingly. 2. Move double A[N] outside the main function as it exceeds the stack memory. 3. Initialize i and increase it after reading a[i]. 4. You have two statements of cin >> a[i]. Delete the second one. 5. Eliminate %25.4 from the printing, leave just %.4 You'll get AC. Edited by author 08.09.2011 20:29 could you tell me , why 131072? The statement say that the input size does not exceed 256KB that means 262144 bytes. The "worst" input should be "d d d" etc (one digit number, one space) so there can be maximum of INPUT/2 numbers. 2 morbidel: thank you very much! | | please help me | NoN | 1012. K-based Numbers. Version 2 | 25 Oct 2011 20:08 | 1 | #WA 6 And give me some test,please )))))))) | | Is O(N^2) the fastest solution ? | N.M.Hieu ( DHSP ) | 1416. Confidential | 25 Oct 2011 16:23 | 6 | I think O(N^2) ( Prim + DFS )is the fastest way to solve this problem , is it right ? Tell me, Why Kruscal+DFS doesn't work? I have TLE#12. Should I write Prim? I think Kruskal + DFS is enough. Maybe you need to optimize your code. Nguyen Dinh Tu ( DHSP ), my fiend , has got AC with the complexity O(N^3)( 0.89s ) . He used Prim , too. OK, then tell me, please, how to find the second answer? I use DFS... May be I should delete the largest vertic and run Kruscal again? You may try adding each non-MST edge to the MST and delete the longest MST edge in the cycle. I don't know how, but my O(n^2) solution works 0.312 sec) | | What is the right answer on this test? | olpetOdessaONU [1 2/3] | 1728. Curse on Team.GOV | 25 Oct 2011 14:56 | 2 | 1 2 Kantorov Rubinchik 100 10 1 Rubinchik 20 I think it "Win Rubinchik" because team "Kantorov Efremov Rubinchik" is not played at all. | | how to take in account the time ? | svr | 1764. Transsib | 25 Oct 2011 12:58 | 2 | Is it standard maxflow problem? May be it is 4-types of products flow? AC without times using. LP problem for 4-component flow with help of simplex method(my smpmeth is above struct{__int64 intpart;__int64 num;__int64 denum;char sign;};) By the way, very good question: why maxflow algo doesn't work. Edited by author 24.10.2010 01:48 Edited by author 24.10.2010 01:49 Maxflow algo doesn't work because it uses ways like M-1-2-3-Y or M-4-5-6-Y, that are not available. |
|
|