| Show all threads Hide all threads Show all messages Hide all messages |
| How to solve it fast and cool? | Laise | 1063. Domino Puzzle | 22 Dec 2016 13:27 | 2 |
I solved it with next algo: I bruteforce all possible connections (if graph consists of several not connected parts) and then add some edges for Euler path with greedy. Of course its right algo, but some complicated (i think). Does anyone knows more simple one? Only use buffered i/o )). |
| wa 20 | Arsen | 1297. Palindrome | 22 Dec 2016 10:53 | 1 |
wa 20 Arsen 22 Dec 2016 10:53 |
| Обратный корень Java | Ilimsky | | 21 Dec 2016 21:35 | 2 |
Подскажите кто нибудь что я делаю неправильно? import java.util.*; import static java.lang.Math.*; public class Sqrt{ public static void main(String[] args){ Scanner in = new Scanner(System.in); System.out.println(sqrt(in.nextInt())); } } |
| Did the problem without using binary search. However it takes 0.109 seconds. | bluestar | 1880. Psych Up's Eigenvalues | 20 Dec 2016 22:28 | 2 |
The main method I followed was to first compare two of the arrays and extract the similar values in another array. I then compared that array with the third array, and updated the counter each time there was a match in eigenvalues. This method avoids comparing all the arrays together, and hence takes up less time. So in essence number of operations reduces to O(2*N^2) instead of O(N^3). However, more sophisticated algorithms like binary search are more effective. But still I include this method for people like myself, who are new to algorithms. Hope it helps someone. Thank you! Did as you said and get Accepted)) 0.046 seconds (FreePascal) |
| Any hints? | Programmer | 1790. Searching for the Truth | 20 Dec 2016 21:36 | 2 |
Any hints for this problem? Try solve 2 sub problems when dodecahedron on odd position and not. |
| What's wrong with my code? (Pascal) | genchildren | 1001. Reverse Root | 20 Dec 2016 02:59 | 4 |
var j,i,n:longint; m:array of real; begin n:=1; while not seekeof do begin read(j); SetLength(m,n); m[n]:=sqrt(j); inc(n); end; for i:=n to 1 do writeln(m[i]:0:4); end. 1. chek type of j. You may have input = 10^18, but max in longint ≈ 2*10^9. 2. Write size of array. 2. Don't know what this is: SetLength(m,n); delete this nah) 3. for i:=n to 1 do |=> for i:=n downto 1 do 4. Chek why for this input: 9. your output is 0.0000 3.0000 little change your programm and get AC)) Edited by author 18.12.2016 03:29 |
| If you want more fast code submit your solution to night , really :))) | c_pp | 1019. Line Painting | 20 Dec 2016 02:37 | 1 |
|
| WA9 | Stanislav Beskorovainiy | 1123. Salary | 19 Dec 2016 19:29 | 1 |
WA9 Stanislav Beskorovainiy 19 Dec 2016 19:29 I don't understand what's wrong in my program. Give me test 9 please |
| Why this problem rejudged?? | Shen Yang | 1415. Mobile Life | 19 Dec 2016 13:11 | 1 |
is there something invalid in test cases?? |
| What is in the test 26? | [kubsu] Eugene Kudinov | 1378. Artificial Intelligence | 18 Dec 2016 22:11 | 1 |
Help! What is in the test 26? |
| How to get speed 0.001 seconds ???? | Ruben Ashughyan | 1048. Superlong Sums | 18 Dec 2016 15:47 | 5 |
-- use fread | fwrite; -- do not use << if >> statement or minimize it; -- minimize div and mod operations ( % , / operators); -- instead of % , / operators may to use pre-calculated arrays. -- and last, need lucky :) 10^6 numbers --> input file size ~4 Mbytes, and output file size ~1 Mbytes. MY PC i-core 3 , 3 GB RAM, gcc 5.4.0 with option: g++ -Wall -O3 -std=c++14 reads/writes took 6-9 milliseconds. So there need something magic tricky to solve this with time < 1 milliseconds !!!!! I got 0.001s AC!! buffered i/o helped me. Your program ate 12 Mb memory. So I suppose you are reading the whole numbers and then do addition. It isn't necessary. It's possible to add numbers digit by digit (yes, from high digits to low) without any arrays usage - 0.3s even using scanf/printf. And yes, use fread/fwrite. Edited by author 13.12.2016 22:15 |
| Heeeh) Wa8 | Rocky.B | 1741. Communication Fiend | 17 Dec 2016 20:13 | 1 |
Forgot to sort the updates :) |
| WA #22 | TR Sriram | 1611. Decimation | 16 Dec 2016 18:58 | 2 |
WA #22 TR Sriram 8 Sep 2015 20:27 I am getting WA in 22nd case! I cant find my mistake. Can someone help me ? Re: WA #22 Tolstobrov Anatoliy[Ivanovo SPU] 16 Dec 2016 18:58 Try this: 20 1 00000000100000000001 Answer: 0 1 15 |
| WA 23 | zahisho | 1238. Folding | 15 Dec 2016 23:18 | 1 |
WA 23 zahisho 15 Dec 2016 23:18 Please could anybody give me the test case? Thanks |
| If you get WA on #7/#15/#17 | WagJK | 1297. Palindrome | 15 Dec 2016 16:12 | 2 |
If you are using int(s[i]) to get the representation for any alphabet, you may need to enlarge your counting sort table and counting sort iteration limit. I thought 200 was enough for latin alphabets, but actually I tried several times and succeeded at about 1100. I don't even know why... |
| 34 WA | Vadimzzz | 1820. Ural Steaks | 15 Dec 2016 12:56 | 2 |
34 WA Vadimzzz 15 Dec 2016 12:50 |
| Why read text with std::getc got AC 0.001s and fread got AC 0.015s for C++ compilers ???? | c_pp | 1027. D++ Again | 15 Dec 2016 00:14 | 1 |
char s[16384] ; unsigned n = 0; // AC 0.001s with this code. for(int c = std::getc(stdin); c != EOF; c = std::getc(stdin)) s[n++] = c; // and AC 0.015s with n = fread(s,1,sizeof(s)-1,stdin); code. // I'm wonder that the std::getc faster than fread!! |
| Formula | Sanatbek_Matlatipov | 1902. Neo-Venice | 14 Dec 2016 22:51 | 2 |
Formula Sanatbek_Matlatipov 7 Oct 2015 23:29 System.out.printf("%.6f\n",(t+s+ss[i])/2d); It have solution with no arrays, lol) And (t+x+si)/2.0 right too, but some simply) I know, that my English bad( |
| WA on test #28 | Shen Yang | 1399. Economical Director | 14 Dec 2016 20:03 | 5 |
any one help?? I need help... I use radom to generate 200 chain list,and then cut the chain list, using O(polynomial) dynamic programming, it is WA on test # 26, then I use regular brute_force search times>=1e7 return, it WA on test #28... anyone give some ideas?? I think cut the chain method get WA is because though between two rows there is at most one same buyer, but there maybe more then two rows have same buyers for exmaple ,structure of solution maybe 0--1---2--3--4--5---0 0--1--6--0 0--2--7--0 0--3--8--0 0--4--9--0 0--5--10--0
Edited by author 14.12.2016 14:14 AC now it is some stupid bugs on my code?? btw , I think this problem is much easier than ural 1394 why not find accuarcy solution? |
| Puzzled by test #5 | deserts | 1093. Darts | 14 Dec 2016 19:56 | 5 |
I'm sure my source code is perfect. But it never passed test #5. Can anyone help me? #include <stdio.h> #include <math.h>
int main() { double cx,cy,cz,nx,ny,nz,r,sx,sy,sz,vx,vy,vz,t; double x,y,z; double a,b,c; int hit; scanf("%lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf %lf",&cx,&cy,&cz,&nx,&ny,&nz,&r,&sx,&sy,&sz,&vx,&vy,&vz); b=nx*vx+ny*vy+nz*vz; c=nx*(sx-cx)+ny*(sy-cy)+nz*(sz-cz); a=-5*nz; if(b*b-4*a*c<-1e-8) printf("MISSED\n"); else if((b+sqrt(b*b-4*a*c))/nz<-1e-8 && (b-sqrt(b*b-4*a*c))/nz<-1e-8) printf("MISSED\n"); else { hit=0; t=(b-sqrt(b*b-4*a*c))/(10*nz); if(t>1e-8) { x=sx+vx*t; y=sy+vy*t; z=sz+vz*t-5*t*t; if(r-sqrt(pow(x-cx,2)+pow(y-cy,2)+pow(z-cz,2))>1e-8) ++hit; }
t=(b+sqrt(b*b-4*a*c))/(10*nz); if(t>1e-8) { x=sx+vx*t; y=sy+vy*t; z=sz+vz*t-5*t*t; if(r-sqrt(pow(x-cx,2)+pow(y-cy,2)+pow(z-cz,2))>1e-8) ++hit; } if(hit) printf("HIT\n"); else printf("MISSED\n"); } return 0; } I couldn't pass fifth test too, and I had mistake described above. Maybe, there is another mistake in your program. The test 5 in TIMUS is the case when the trace of dart only touches the dartboard in one point (i.e. like the parabola touches the plane). When I had understood this fact I got AC. Edited by author 21.03.2009 17:26 Edited by author 21.03.2009 17:26 So if it touches the plane should we consider it as a hit? My solution also fails WA#5 and I don't understand why... any hints guys? |