Search found 19 matches

by gits
Fri Sep 02, 2005 1:24 am
Forum: Other words
Topic: a lot of WAs..
Replies: 7
Views: 3260

i need your hint or send me your .exe file .

I guess you shouldn't execute any program someone you don't know sends you...
by gits
Sun Jan 30, 2005 3:05 am
Forum: Volume 4 (400-499)
Topic: 445 - Marvelous Mazes
Replies: 93
Views: 10425

Don't write a newline after the last test case.
by gits
Wed Jan 26, 2005 7:36 am
Forum: Volume 101 (10100-10199)
Topic: 10190 - Divide, But Not Quite Conquer!
Replies: 105
Views: 23924

yiuyuho, I totally agree with you. However, in my first submission I produced output "1" for input "1 1" and got WA, then changed it to "Boring!" and it was accepted.

So k must be > 1, but the description isn't very accurate.
by gits
Mon Jan 24, 2005 6:37 pm
Forum: Volume 100 (10000-10099)
Topic: 10035 - Primary Arithmetic
Replies: 328
Views: 57391

I couldn't even compile your program. First, you must change main() return type to int, and finish main with "return 0;" After making this change it compiled, but it immediately crashed with Segmentation Fault. That means it didn't even produce output and that you have some invalid memory reference ...
by gits
Mon Jan 24, 2005 6:33 pm
Forum: Volume 6 (600-699)
Topic: 623 - 500!
Replies: 187
Views: 43883

char final[4000]; ... for (i=4000;final[i]==0;i--){ final will be final[4000] in the first iteration, which may be the cause of RE. Either make i=3999 or increase final[] size to 4001. Same thing here: for (i=4000;cal[N][i]==0;i--){ When you declare something like, "int array[100];" the valid posit...
by gits
Mon Jan 24, 2005 6:27 pm
Forum: Volume 4 (400-499)
Topic: 495 - Fibonacci Freeze
Replies: 222
Views: 30635

I solved this problem with an array sized 5000*1100 and judge reported 64k memory. I believe the memory the judge reports is dynamic memory, not static.

Think of this input:

5000
5000
5000
...

It's clear it's better to memorize the outputs than to calculate them every time.
by gits
Mon Jan 24, 2005 6:24 pm
Forum: Volume 4 (400-499)
Topic: 445 - Marvelous Mazes
Replies: 93
Views: 10425

Problem says no line will be greater than 132 chars, so it can have at most 132 chars, so you must have space for 132 chars plus the ending '\0'.

Try to increase your buf size.
by gits
Thu Jan 20, 2005 4:12 pm
Forum: Volume 1 (100-199)
Topic: 114 - Simulation Wizardry
Replies: 80
Views: 7619

Hi again! I've already solved this one, but my first atempt was Wrong Answer. Let me draw the table of the sample input: XXXX X_BX XB_X XXXX The X are walls B are bumpers. The problem says that 1 <= x <= m and 1 <= y <= n. But the limit positions are walls. That means (3,4) isn't a valid position, n...
by gits
Wed Jan 19, 2005 5:09 pm
Forum: Volume 1 (100-199)
Topic: 104 - Arbitrage
Replies: 223
Views: 13867

try this input: 6 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.1 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 5.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 9.0 0.0 0.0 0.0 0.0 1.0 output should be 5 6 5 but your program gives 5 6 1 which is wrong, because you have to end in the same place as you started. Actually, you have a silly bug :D ch...
by gits
Wed Jan 19, 2005 11:52 am
Forum: Volume 1 (100-199)
Topic: 104 - Arbitrage
Replies: 223
Views: 13867

Hi! table was a misspelling, I intended to write "best". So it's: for (steps = 2; steps <= n; steps++) for k... for i.. for j.. tmp = best[i][k][steps-1] * best[k][j][1] if (tmp > best[i][j][steps]) { best[i][j][steps] = tmp; path[i][j][steps] = k; } Sorry for the confusion! Notice that best [j][s] ...
by gits
Mon Jan 17, 2005 4:59 pm
Forum: Volume 1 (100-199)
Topic: 104 - Arbitrage
Replies: 223
Views: 13867

Floyd-Warshall finds all the mininum paths between every vertex and all the other vertexes. However, in this problem you not only have to find the shortest path, it also has to make a profit of more than 1%. Simple F-W goes like this: // initialization for (i = 0; i < n; i++) { for (j = 0; j < n; j+...
by gits
Sat Jan 15, 2005 5:47 pm
Forum: Volume 1 (100-199)
Topic: 104 - Arbitrage
Replies: 223
Views: 13867

Well, I'll assume you understand what the problem asks. You have to find the shortest sequence that yelds a profit (not the one with the greatest profit!). If there is more then one sequence with the same length, any of those is valid. Now, you can't just try with brute force (trying all combination...
by gits
Fri Jan 14, 2005 9:13 pm
Forum: Volume 1 (100-199)
Topic: 104 - Arbitrage
Replies: 223
Views: 13867

hints for 104

I've been trying to solve this problem for sooo long and finally got AC so today is a memorable day for me :) So here are some clues for those who haven't solved it yet. 1) There are some posts talking about floating point errors, but I didn't check for any in my solution. I use a simple test if (pr...
by gits
Wed Jan 12, 2005 2:53 am
Forum: Other words
Topic: very very annoying Presentation Errors
Replies: 1
Views: 1319

very very annoying Presentation Errors

I've already come across several problems which are not precise on the output format, and since I try very hard to keep my total submissions at a minimum, it's very annoying to spend around 10 or more submissions to figure out why I'm getting PE!! Some problems I just haven't figured how should the ...
by gits
Sat Jan 08, 2005 6:19 pm
Forum: Volume 100 (10000-10099)
Topic: 10018 - Reverse and Add
Replies: 169
Views: 17894

Some compilation errors... First, don't use <iostream.h>, instead use #include <iostream> using namespace std; Second, the main function must return an int; always return from main with return 0; And there's a warning about unused variable "char temp". Your program failed for this input: 1 429496295...

Go to advanced search