Search found 94 matches

by the LA-Z-BOy
Sat Aug 12, 2006 2:30 pm
Forum: Volume 109 (10900-10999)
Topic: 10923 - Seven Seas
Replies: 28
Views: 11819

My AC program gives I'm the king of the Seven Seas! Oh no! I'm a dead man! Oh no! I'm a dead man! I'm the king of the Seven Seas! I'm the king of the Seven Seas! I'm the king of the Seven Seas! I'm the king of the Seven Seas! I'm the king of the Seven Seas! I'm the king of the Seven Seas! I'm the ki...
by the LA-Z-BOy
Sun Jun 25, 2006 8:43 pm
Forum: Volume 5 (500-599)
Topic: 517 - Word
Replies: 13
Views: 5401

You need exactly 8 rules here.... Because your change of character depends on 3 characters... ( |{a,b}| = 2 and dependency on 3 chars that's 2^3 = 8 ), that's why there are 8 rules. At first step ( or whatever step) ... you should apply those rules which is applicable there... not the first rule onl...
by the LA-Z-BOy
Sun Jun 25, 2006 6:42 pm
Forum: Volume 100 (10000-10099)
Topic: 10038 - Jolly Jumpers
Replies: 445
Views: 79190

Your program should crash for Array index out of bounds .... Consider these line in your code for(int g = 0; g<(abs(n)-1); g++){ diff = abs(a[g] - a[g+1]); array[diff] = 1; } If the input is like 2 1 50000 Your program will try to index array[49999] which is not clearly good. so you have check cases...
by the LA-Z-BOy
Sun Jun 25, 2006 6:19 pm
Forum: Volume 1 (100-199)
Topic: 108 - Maximum Sum
Replies: 233
Views: 22751

If you can solve ONE-D problem in O(n) then you can do a 2D maximum sum in O(N^3).... Tip: Convert the 2D array to an ONE-D array problem in O(n^2) and you are fine....
by the LA-Z-BOy
Sun Jun 25, 2006 12:43 am
Forum: Volume 1 (100-199)
Topic: 147 - Dollars
Replies: 233
Views: 21256

I dont know how you could NOT expect WA???? You just don't even match the sample cases given in the problem!!!! v=12 Musn't it be v=11 ??? and more, if you take the input as double , you can have precision errors.... it can be done with only integers to calculate the Cents. and if you are to use dou...
by the LA-Z-BOy
Sun Jun 25, 2006 12:26 am
Forum: Volume 101 (10100-10199)
Topic: 10190 - Divide, But Not Quite Conquer!
Replies: 105
Views: 23929

Search the topics about the problem before you post. There are already LOT of posts about this topic... You can get your answers from there.
http://acm.uva.es/board/viewtopic.php?t=2474
You have to think about cases where m = 1 or m = 0.
by the LA-Z-BOy
Tue Jun 20, 2006 9:22 pm
Forum: Volume 4 (400-499)
Topic: 498 - Polly the Polynomial
Replies: 73
Views: 13620

char word[MAX][10];
seems too small here... get something like
char word[MAX][20];
Also you would get Presentation Error on this, because you are printing extra space at end of each line.
Greetings.
by the LA-Z-BOy
Tue Jun 20, 2006 8:58 pm
Forum: Volume 4 (400-499)
Topic: 442 - Matrix Chain Multiplication
Replies: 21
Views: 3390

Add these two returns on error case in your expression() function,
expression();
if ( Error) return;
expression();
if ( Error) return;
These helps to get AC :).
ps. please remove the code and please please post formatted code.... its hard to watch it without that :P
Cheers.
by the LA-Z-BOy
Tue Jun 20, 2006 8:40 pm
Forum: Volume 4 (400-499)
Topic: 453 - Intersecting Circles
Replies: 84
Views: 15014

What compiler are you using ?
by the LA-Z-BOy
Sun Jun 18, 2006 3:22 pm
Forum: Volume 109 (10900-10999)
Topic: 10923 - Seven Seas
Replies: 28
Views: 11819

A ship is destroyed if it moves to a cell that contais a rock.
Both your ship and the enemy ships are `ships', right ?
by the LA-Z-BOy
Sun Jun 18, 2006 3:10 pm
Forum: Volume 109 (10900-10999)
Topic: 10927 - Bright Lights
Replies: 26
Views: 13769

Most probably you are facing precision errors due to floating point calculation. It can be solved without using floating point arithmetic at all, only integers.
by the LA-Z-BOy
Thu Jun 15, 2006 5:36 pm
Forum: Volume 2 (200-299)
Topic: 256 - Quirksome Squares
Replies: 30
Views: 4647

You are getting Output Limit Exceeded because your program doesn't break the loop. Your condition is while(scanf("%d",&c)!=0){ scanf returns EOF(equivalent to -1) on end-of-file / error, not ZERO . so it could be written as while(scanf("%d",&c)!=-1){ or while(scanf("%d",&c)!=EOF){ or while(scanf("%d...
by the LA-Z-BOy
Thu Jun 15, 2006 5:24 pm
Forum: Volume 4 (400-499)
Topic: 453 - Intersecting Circles
Replies: 84
Views: 15014

Well, this is a very teasing problem.... Very hard to get Accepted. There are LOT discussion about this problem already in this board. Watch them carefully if you haven't already. There is a very good input set provided by Adrian Keugel in those topics. But what I remember was just passing those tes...
by the LA-Z-BOy
Thu Jun 15, 2006 5:17 pm
Forum: Volume 102 (10200-10299)
Topic: 10235 - Simply Emirp
Replies: 150
Views: 31315

Consider these codes in your prime generating ... for(i=103;i<999998;i+=2) { prime=1; for(j=2;j<sqrt(i)+1;j++) { .... These are too costly ... because for each i you call sqrt() function i^0.5 times!!! sqrt() is slow and calling it so many times would get you TLE. You can avoid these by changing it ...
by the LA-Z-BOy
Thu Jun 15, 2006 4:38 pm
Forum: Volume 1 (100-199)
Topic: 146 - ID Codes
Replies: 35
Views: 5763

Well, Well.... what would you expect if you run a code like if ( a[0] > a[-1]) or something ? Ask yourself as if you were a compiler :) you might have got a run time error on invalid memory referencing ... the compiler behaviour is unexpected ... that's the point..... so its not important at which c...

Go to advanced search