Search found 51 matches

by zsepi
Sun Feb 29, 2004 8:00 pm
Forum: Algorithms
Topic: BACKTRACKING
Replies: 5
Views: 2171

iterative backtracking

use a stack - every time when you'd go one more level into the recursion, store all your variables on the top of the stack, and modify the variables to values they would have taken in the next recursion step. when you would return from a recursion call, just pop the top of the stack and store them i...
by zsepi
Sun Feb 29, 2004 7:40 pm
Forum: Volume 105 (10500-10599)
Topic: 10525 - New to Bangladesh?
Replies: 50
Views: 20007

If you use 32-bits signed integers and 2^30 as value for infinity, than newdist can become 2^30+2^30 = 2^31, which is smaller than zero! joey, I'm aware of that problem, that's why I have in the comparison if(g[from][intermed].time != INF && g[intermed]toj].time != INF) { time = g[from][intermed].t...
by zsepi
Sun Feb 29, 2004 12:20 am
Forum: Volume 105 (10500-10599)
Topic: 10525 - New to Bangladesh?
Replies: 50
Views: 20007

thanks per!

it's not paranoia..... 2^61 seems to be the right value for infinity. That was the only thing I changed, and got ac... stupid stupid bug
by zsepi
Sat Feb 28, 2004 8:07 pm
Forum: Volume 105 (10500-10599)
Topic: 10525 - New to Bangladesh?
Replies: 50
Views: 20007

what hs changed since last post, 'coz WA

I keep getting WA and it frustrates me quite a lot (not surprising, eh?) After reading the forum, I became even more confused (usually the opposite happens), so I would like to ask a few questions 1) edge overwriting So, when I add an edge, I should always keep the latest one, or should I keep the e...
by zsepi
Fri Nov 07, 2003 7:13 am
Forum: Volume 2 (200-299)
Topic: 243 - Theseus and the Minotaur (II)
Replies: 22
Views: 7518

WA :(

I get WA, though (of course) I pass the standard example.... i would really appreciate some crucial input. so far I managed to think of the case when T & M are in the same passage, of course T should die, T & M both can go through each edge twice (one time each way), if the format of the standard in...
by zsepi
Wed Jul 02, 2003 3:01 am
Forum: Volume 101 (10100-10199)
Topic: 10194 - Football (aka Soccer)
Replies: 119
Views: 36863

WA

I have a feeling that i have problems with the final sorting (lexographic) - would appreciate tricky inputs and/or comments on this code fragment - thanx! [c]struct team { char name[L]; int points, wins, scored, against, played, ties; }teams[MX]; int my_strcmp(char *a, char *b) { static char ch1, ch...
by zsepi
Wed Jul 02, 2003 12:03 am
Forum: Volume 7 (700-799)
Topic: 739 - Soundex Indexing
Replies: 39
Views: 13735

hi, i'm afraid a formatting problem keeps giving me WA... could someone check if it gives the output in the right format? appreciated! [c]main() { char line[50], *name, *sx, *s; /* name is the name, sx is the soundex code */ int i, j; for(i = 0; i < 50; i++) line = ' '; sx = &line[34]; name = &line[...
by zsepi
Tue Jul 01, 2003 10:57 pm
Forum: C
Topic: Modulo Operation with big numbers
Replies: 2
Views: 2076

rz, as far as I know fmod takes double parameters - and I am pretty positive that numbers in the range of 10^101 are not really fitting in a double.... plus I believe that this problem wasn't designed to be solved by standard library fucntions. There are several problems on the acm site, which are r...
by zsepi
Thu Jun 26, 2003 11:59 pm
Forum: Algorithms
Topic: Find second min number .
Replies: 10
Views: 4310

question about the tournament algo

if I am using the tournament algo, what happens if I have repeated numbers, and during the random pairs comparison i might compare let's say, 2 (x) and 2 (y). then it will say that (if x > y comparison is used) the second 2 (y) beat the first 2 (x) - now assuming that all the other numbers are great...
by zsepi
Thu Jun 26, 2003 2:14 am
Forum: Volume 105 (10500-10599)
Topic: 10518 - How Many Calls?
Replies: 19
Views: 13553

Re: 10518 WA ?

i got stuck on this problem - I was trying to use the explicit formula for the nth fibonacci numbers, and then multiply by two, minus one, but above a certain range I get infinity fro the nth fibonacci number - not surprisingly it doesn't fit into a long double... so if someone could explain me the ...
by zsepi
Mon Jun 23, 2003 1:15 pm
Forum: Volume 101 (10100-10199)
Topic: 10193 - All You Need Is Love
Replies: 23
Views: 9457

speed

I've just solved the problem, but I w/ a surprisingly slow time 8.174 seconds and using 388 kb memory and on the ranklist everyone is having 0.00:00 times.... and i am playing around with register variables, all function variables (except for arguments) not register are static so I am totally puzzle...
by zsepi
Sun Jun 22, 2003 11:05 pm
Forum: Volume 100 (10000-10099)
Topic: 10019 - Funny Encryption Method
Replies: 45
Views: 5566

trinity, I'd say that that line shouldn't be the reason why you get compiler error... check out the judge's info pages about JAVA, 'coz I believe they aren't using the sun java compiler, but the gcj - read more about JAVA support: http://acm.uva.es/problemset/java.html http://acm.uva.es/problemset/h...
by zsepi
Sun Jun 22, 2003 10:59 pm
Forum: C
Topic: How to make it in C? (me again:P)
Replies: 4
Views: 2495

most of the time I use this site for quick reference:
http://www.cplusplus.com/ref/
to answer your specific question, here is the documentation on printf: http://www.cplusplus.com/ref/cstdio/printf.html
though you might wanna have a look at some C tutorial...
by zsepi
Sun Jun 22, 2003 12:27 pm
Forum: Volume 100 (10000-10099)
Topic: 10038 - Jolly Jumpers
Replies: 445
Views: 79300

Re: 10038 W.A

lendlice, I think you might have misunderstood the problem, bacause you only check if the difference between two consecutive numbers is bigger than 0 and less than many . Just to check out this input: 5 3 2 3 2 3 and obviously, it's not good. you need to check if all the differences take on all the ...
by zsepi
Wed Jun 18, 2003 11:39 pm
Forum: Volume 102 (10200-10299)
Topic: 10235 - Simply Emirp
Replies: 150
Views: 31368

hi r.z., i am pretty positive you are getting TLE because of the way you check primality.... in most problems where primes are involved it's worth to pregenerate the primes in an array, and in this particular problem just binsearch that array to see if the number you have is there or not... if you l...

Go to advanced search