Search found 79 matches

by ec3_limz
Sun Jun 20, 2004 7:53 pm
Forum: Volume 101 (10100-10199)
Topic: 10100 - Longest Match
Replies: 95
Views: 21707

Runtime Error SIGSEGV

Can anyone tell me what's wrong with this (I got Runtime Error SIGSEGV) [cpp] // ACM #10100: Longest Match #include <ctype.h> #include <stdio.h> #include <string.h> #define MAXLLEN 1000 #define MAXWLEN 20 #define MAXNW 55 #define MAX(A,B) ((A)>(B)?(A):(B)) char line[MAXLLEN+1],w1[MAXNW+1][MAXWLEN+1]...
by ec3_limz
Sun Dec 21, 2003 4:23 pm
Forum: Algorithms
Topic: help with one "usaco hard problem" ... please.....
Replies: 19
Views: 9785

Help needed for USACO problem

Hi, I am at USACO section 1.2.5 and am stuck at the problem Stringsobits. I tried generating all possible strings and of course got TLE when my program had to generate 2^31 strings. Here's the problem. I would appreciate any help given. Thank you very much. Consider an ordered set S of strings of N ...
by ec3_limz
Mon Nov 17, 2003 5:17 pm
Forum: Volume 6 (600-699)
Topic: 600 - A Duckpin Tournament
Replies: 12
Views: 6956

600 - A Duckpin Tournament

Couldn't find any mistakes in this code. Tested with many test cases and all ran perfectly, but I still get a WA from the judge. Please help. [cpp]#include <stdio.h> #include <stdlib.h> #include <string.h> const int NOSCORE=16843009; struct { char name[11]; int sc[3][30]; // score for each try } guy...
by ec3_limz
Wed Jun 25, 2003 12:40 pm
Forum: Algorithms
Topic: Number Theory!!!!
Replies: 10
Views: 4389

Is there any particular problems of number theorey?
please any1 write the name and no of problems related to number theorey.
Well, there are many problems that require a good foundation in Mathematics to solve. After all, algorithmics and programming have a base in Mathematics and logic.
by ec3_limz
Wed Jun 25, 2003 12:31 pm
Forum: Other words
Topic: An Important Request !!!!!!!!!!
Replies: 14
Views: 3085

Please don't distribute your solutions against requests via emails. May be one person is trying to gather codes in different identities. Also, certain people may be solving ACM problems as part of their homework, so sending them the solutions via email is equivalent to doing their homework for them...
by ec3_limz
Mon Jun 23, 2003 12:46 pm
Forum: Volume 6 (600-699)
Topic: 617 - Nonstop Travel
Replies: 9
Views: 3934


Hi, I got a WA for the following code. I have a strong feeling that the error is due to inaccuracy in using floating point real numbers. However, the possibility of a flawed algorithm must not be ruled out. I would appreciate any help provided, as well as sample test cases. Thank you in advance. [cp...
by ec3_limz
Mon Jun 23, 2003 12:43 pm
Forum: Volume 6 (600-699)
Topic: 636 - Squares (III)
Replies: 7
Views: 3530

The problem statement states that, for each number, there exists a sought base and it is less than 100 Therefore, I do not think that you have to consider base 100. This is so far the only difference I can see between your code and my code, which was Accepted. You may want to try this. Good luck.
by ec3_limz
Fri Jun 20, 2003 7:28 pm
Forum: Volume 6 (600-699)
Topic: 639 - Don't Get Rooked
Replies: 11
Views: 9300

Using standard backtracking is enough to solve this problem. I am actually quite surprised that greedy algorithm works for this problem. My greedy algorithm works like this. 1. For each position p on the board, find the number of positions that a rook placed at p can attack. Let a[ p ] be the numbe...
by ec3_limz
Fri Jun 20, 2003 7:08 pm
Forum: Volume 1 (100-199)
Topic: 147 - Dollars
Replies: 233
Views: 23669

It is actually possible to solve the problem without using floating point real numbers. That way, you will not face problems such as inaccuracy. Try to use integers as far as possible.
by ec3_limz
Fri Jun 20, 2003 7:03 pm
Forum: Volume 1 (100-199)
Topic: 100 - The 3n + 1 problem
Replies: 1394
Views: 193797

Am I right to say the OJ accepted the wrong answer?
You may want to post your source code here.
by ec3_limz
Fri Jun 20, 2003 6:44 pm
Forum: C++
Topic: About CPU time
Replies: 5
Views: 2782

well problemsetter bhai, thanks for your great teaching. it's very important use. will it work on cygwin? will there be any problem to judge if i use clock_t will it return compile error? I think the functions in time.h are available for any compiler. However, I don't see any point in sending a pro...
by ec3_limz
Fri Jun 20, 2003 6:35 pm
Forum: General
Topic: Never use yahoomail for submission
Replies: 6
Views: 1805

Just use Submit-o-matic and all such problems will be solved.
by ec3_limz
Tue Jun 17, 2003 4:53 am
Forum: Volume 6 (600-699)
Topic: 616 - Coconuts, Revisited
Replies: 37
Views: 12099

If n is the number of people, then
(n^n-n+1) is the number of coconuts. Am I right? And if I am, then why do I get WA?
The formula n^n-n+1 does not work.
by ec3_limz
Mon Jun 09, 2003 3:41 pm
Forum: C
Topic: quicksort built in
Replies: 8
Views: 8496

Compare function. [cpp]int cmp(const void *va, const void *vb) { tdata *a = (tdata*)va; tdata *b = (tdata*)vb; return a->key - b->key; }[/cpp] Calling the quicksort function. [cpp]qsort(data, 1000, sizeof(data), cmp);[/cpp] Quite easy. The skill of using the function comes with experience. Good luck.
by ec3_limz
Mon Jun 09, 2003 3:28 pm
Forum: C++
Topic: memset
Replies: 4
Views: 2504

However, do take note that since int and double are not 1 byte, you cannot do things like memset(a, 1, sizeof(a)) and expect a[0..99] to be 1.
You can use memset to set an array all to 0 or -1. I do not know of any other values that will work, unless you memset a char array of course.

Go to advanced search