Search found 24 matches

by dh3014
Sat Jul 20, 2002 2:50 pm
Forum: Volume 103 (10300-10399)
Topic: 10324 - Zeros and Ones
Replies: 179
Views: 42833

Re: about acm 10324

Homeway Liu wrote:[c]
c = num - num[a];
if( c == 0 || c == b - a)
printf("Yes\n");
[/c]

sorry I didn't look your code carefully first time.
I found the above statement is absolutely incorrect...
try the following input:
01
1
0 1
You'll found your program output "Yes"
by dh3014
Fri Jul 19, 2002 2:28 pm
Forum: Volume 1 (100-199)
Topic: 158 - Calendar
Replies: 44
Views: 7391

Notice the sorting order(STAR FIRST!!), and there's one tricky input is the schedule may be in two different years!!
by dh3014
Fri Jul 19, 2002 1:19 pm
Forum: Volume 103 (10300-10399)
Topic: 10324 - Zeros and Ones
Replies: 179
Views: 42833

I think you may try enlarge your buf[] array size to:
[c]
char buf[1000002];
[/c]
instead of 1000000, the reason we need two more space is because you need one char to store the ending char '\0', and the other one, since you use fgets, will store the end line char '\n'
by dh3014
Thu Jul 18, 2002 2:06 pm
Forum: Volume 103 (10300-10399)
Topic: 10319 - Manhattan
Replies: 9
Views: 5701

I'm working with this problem now. I did use method similar with 2-SAT problem, I first construct a graph use following way: Let each street and each avenue be two vertecies, one means the positive direction and the other means the negative direction. And then for each route (s1, a1, s2, a2), if s1 ...
by dh3014
Thu Jul 18, 2002 4:21 am
Forum: Volume 103 (10300-10399)
Topic: 10328 - Coin Toss
Replies: 19
Views: 7549

my recurrence is:

Code: Select all

T(i) = 2T(i - 1) + 2^(i-k) - T(i-k-1)
by dh3014
Tue Jul 16, 2002 6:38 pm
Forum: Volume 103 (10300-10399)
Topic: 10313 - Pay the Price
Replies: 42
Views: 19187

Please, see the previous articles in this Volumn.
Joe Smith has provided a great way to solve the problem and the complexity is O(n^2)
by dh3014
Tue Jul 16, 2002 5:12 am
Forum: Volume 103 (10300-10399)
Topic: 10323 - Factorial! You Must be Kidding!!!
Replies: 106
Views: 31873

indeed...by definition
f(-1) = 1 / 0 should be NaN instead of Inf

lim 1 / n is Inf
n->0+
by dh3014
Tue Jul 16, 2002 5:05 am
Forum: Volume 103 (10300-10399)
Topic: 10328 - Coin Toss
Replies: 19
Views: 7549

my solution uses no combination numbers.
I just maintain an array table[101],
which table means how many solutions in i coins.
Find the recurrence and use dynamic programming skills to solve the problem. The recurrence contains terms represented as power of 2, think of it.
by dh3014
Thu Jul 11, 2002 5:16 am
Forum: Volume 103 (10300-10399)
Topic: 10321 - Polygon Intersection
Replies: 17
Views: 7176

dh3014

I've solved acm137 already, but not this one...
That's why I posted here to seek help.
by dh3014
Thu Jul 04, 2002 3:55 am
Forum: Volume 103 (10300-10399)
Topic: 10321 - Polygon Intersection
Replies: 17
Views: 7176

10321 - Polygon Intersection

Do I need to do convex hull in this problem?
by dh3014
Wed Jul 03, 2002 2:03 am
Forum: Volume 103 (10300-10399)
Topic: 10313 - Pay the Price
Replies: 42
Views: 19187

But, you can solve it in O(n^2)... you only need to fill a 300x300 array, where A [j] is the # of ways of getting $i total dollars where all the coins are of value at most j. I have a problem... I did use O(n^2) space complexity, but although I maintain A[300][300], I still need to use O(n^3) time ...
by dh3014
Wed Jul 03, 2002 1:56 am
Forum: Other words
Topic: when the judge replies - time limit exceed
Replies: 3
Views: 2393

whenever I got a TLE reply, first of all, RETHINK the problem's algorithm...although it seems like a waste of time, but it may be the only way to truly solve the problem. Only few (really few) problems I've written can be solved by just optimized my code. (there's one...10304) By the way, if you sur...
by dh3014
Sun Jun 16, 2002 3:09 pm
Forum: Volume 8 (800-899)
Topic: 843 - Crypt Kicker
Replies: 51
Views: 24970

quite thanks
by dh3014
Sun Jun 16, 2002 7:35 am
Forum: Volume 8 (800-899)
Topic: 843 - Crypt Kicker
Replies: 51
Views: 24970

yes, probably the test data was chosen...
but after I got several WA and test my program several times...
I think I should check it out if there's any mistake judge made.
by dh3014
Sun Jun 16, 2002 6:47 am
Forum: Volume 8 (800-899)
Topic: 843 - Crypt Kicker
Replies: 51
Views: 24970

843 - Crypt Kicker

In the problem description it said:
"If there is more than one solution, any will do. "
but the icon of the problem shows that it doesn't use special judge...
may any adms tell me what's going on?

Go to advanced search