Search found 11 matches

by hongping
Wed Nov 06, 2002 5:15 am
Forum: Volume 7 (700-799)
Topic: 757 - Gone Fishing
Replies: 6
Views: 3560

757 - Gone Fishing

I dont know what's wrong with my code. I am using dynamic programming. Upon submission I get runtime error, invalid memory reference. But I think I allocated enough memory. Can anyone tell me what's wrong or perhaps provide some good test data? Thanks. [cpp] #include <stdio.h> #include <iostream.h> ...
by hongping
Thu Oct 31, 2002 4:50 am
Forum: Volume 103 (10300-10399)
Topic: 10391 - Compound Words
Replies: 40
Views: 17597

>>I thought that saying "two other words" meant "two different words".

I thought so too, and kept getting WA. I changed my program to be able to use the same word twice to create another word. Finally AC.

I agree that the question statement is misleading.
by hongping
Thu Sep 26, 2002 2:38 am
Forum: Volume 102 (10200-10299)
Topic: 10278 - Fire Station
Replies: 59
Views: 21059

WA too

i think you are right... hmm... but i get WA too.

when there isnt any existing fire station, is it so that we should put the firestation at an intersection which has the
minimum (Maximum (shortest distance to ALL other nodes))

?
by hongping
Wed Sep 25, 2002 9:20 pm
Forum: Volume 102 (10200-10299)
Topic: 10278 - Fire Station
Replies: 59
Views: 21059

the test data: 0 4 1 2 10 2 3 10 2 4 10 answer is 2. node 1 to node 2 is 10. and from node 2, you can go to 3 and 4, distance of 10 each. 2 is the "central" node, and if you place firestation there, all other nodes only have a distance of 10 from node 2. if you place the station at 1, 1 to 3 (1->2->...
by hongping
Mon Sep 23, 2002 1:30 am
Forum: Volume 102 (10200-10299)
Topic: 10268 - 498-bis
Replies: 51
Views: 17648

Hi, I dont know what's wrong with my code. I keep getting time limit exceeded. I am using purely integers. [cpp] #include <iostream> #include <string> #include <cstdio> #include <cstdlib> #include <ctype.h> using namespace std; int x,a[1000000]; int xp[100000],n; void process(){ int i,c,sum,v; xp[0]...
by hongping
Sat Sep 21, 2002 2:50 pm
Forum: Volume 102 (10200-10299)
Topic: 10278 - Fire Station
Replies: 59
Views: 21059

Krzysztof,
thanks for the hint.
so i only need to do dijkstra for all the intersections with firestations.

what do you mean by " find the intersection with the lowest distance"?
how do i use this to find which position to place the new fire station?

thanks.

hongping
by hongping
Sun Sep 15, 2002 11:43 pm
Forum: Volume 102 (10200-10299)
Topic: 10278 - Fire Station
Replies: 59
Views: 21059

time limit exceeded

hi i tried using dijkstra n^3 to find distances between all pairs. then iterate through all possible intersection for placement of the new firestation, and then recalculate the max distance, and then find the best.
but i get time limit exceeded. any way to speed up?
by hongping
Sat Aug 31, 2002 3:37 am
Forum: Volume 103 (10300-10399)
Topic: 10352 - Count the eWords
Replies: 30
Views: 12045

WA...

I didnt use strcmp, just replaced all 3rd character with ~, and then use string operator > wonder whats wrong, please help. [cpp] /* @JUDGE_ID: 3162CM 10352 C++ */ #include <stdio.h> #include <string> #include <map> #include <iostream.h> #include <stdlib.h> #include <math.h> #include <vector> #inclu...
by hongping
Sun Aug 11, 2002 7:35 am
Forum: Volume 100 (10000-10099)
Topic: 10070 - Leap Year or Not Leap Year and ...
Replies: 233
Views: 54229

Solution for 10070

I have learnt another (perhaps easier) way of calculating the modulus of long integers. Thanks to Jiawei for letting me see his source code. Here is my accepted solution. #include <stdio.h> #include <string.h> #include <stdlib.h> #include <iostream.h> char a[10000000]; void main(void){ int i,leap,or...
by hongping
Fri Jul 26, 2002 6:01 pm
Forum: Volume 100 (10000-10099)
Topic: 10070 - Leap Year or Not Leap Year and ...
Replies: 233
Views: 54229

still cannot solve

Hmm... I tried implementing a large array and some number theory to check for divisibility... but this still doesnt work. perhaps someone could help me spot my mistake please? thanks a lot! #include <string.h> #include <stdlib.h> #include <iostream.h> #include <stdio.h> void main() { long long y; ch...
by hongping
Fri Jul 26, 2002 5:55 pm
Forum: Volume 100 (10000-10099)
Topic: 10093 - An Easy Problem!
Replies: 52
Views: 15110

Hi, I have taken into consideration the possibility of a + or - sign. But this still doesnt work. Perhaps someone could help me debug please. Thanks a lot! #include <string.h> #include <stdio.h> #include <stdlib.h> #include <iostream.h> char a[2000000]; int v(char c) { if ('0'<=c && '9' >=c) return ...

Go to advanced search