## Search found 47 matches

Sat Jul 31, 2004 5:07 am
Forum: Volume 7 (700-799)
Topic: 727 - Equation
Replies: 156
Views: 36761
I got AC for the first time i submit the code. Just use simple stack algorithm. [cpp] case '(': //push case '-': case '+': //pop "+-*/" to the standard output if it's any of them on top of the stack then push case '/': case '*': //pop "*/" if any on the top of the stack then push case ')': //pop unt...
Thu Jul 29, 2004 4:21 am
Forum: Volume 3 (300-399)
Topic: 334 - Identifying Concurrent Events
Replies: 7
Views: 1865
The output format in the problem description is not clear.

After many times AC(PE) i got AC.

I just output a space after each concurrent events(although there is only one).

Good luck.
Thu Jul 29, 2004 3:44 am
Forum: Volume 101 (10100-10199)
Topic: 10171 - Meeting Prof. Miguel...
Replies: 68
Views: 24920
After many WAs i got AC finally. I use floyed algorithm to compute all pair shortest distance (just for the simple code). My program is ok for all the input above but the judge said WA. I generate a case and it's about many U or B roads connecting two cities. 2 Y U A B 10 Y U A B 100 A B 0 hope it w...
Tue Jul 27, 2004 11:17 am
Forum: Volume 104 (10400-10499)
Topic: 10465 - Homer Simpson
Replies: 75
Views: 23885
I use traditonal DP algorithm O(n) max(n) = 10000 and got AC, but it takes the program 2 sec to generate the right output . I see many people got AC quite fast. Is there some better algorithm or i just code a program not good enough? if any plz contact me via the private message or mail to: jackie@h...
Tue Jul 27, 2004 9:45 am
Forum: Volume 101 (10100-10199)
Topic: 10154 - Weights and Measures
Replies: 60
Views: 41008
I got AC using DP LIS algorithm.

Modified LIS.

I test all the sample inputs in the forum and all make right answer.

Also, I think the prove above is right.
Tue Jul 27, 2004 5:34 am
Forum: Volume 7 (700-799)
Topic: 760 - DNA Sequencing
Replies: 33
Views: 13012
Yes. sidky is right. The problem isn't decribled clearly,.

I got AC using DP algorithm.

Pay attention to the blank line and two complete different strings in the input file which make the answer is "No common sequence.".
Mon Jul 26, 2004 4:00 pm
Forum: Volume 1 (100-199)
Topic: 164 - String Computer
Replies: 120
Views: 12428
i use the same code(only modified for output) to do 526 and got AC

the two sequence listed above both got AC.

maybe the special judge program used in 164 has some falut or there is some constraint for the problem to which i don't pay attention.

if you got any idea, plz contact me

thks
Mon Jul 26, 2004 3:46 pm
Forum: Volume 1 (100-199)
Topic: 164 - String Computer
Replies: 120
Views: 12428
BTW

i think there isn't empty strings in the input file.

after use many assert,

i only use while (scanf("%s %s", d1, d2) == 2)
for the input.

hope it can help
Mon Jul 26, 2004 3:31 pm
Forum: Volume 1 (100-199)
Topic: 164 - String Computer
Replies: 120
Views: 12428
After many many WA, i got AC. I use DP algorithm . Firstly compute the minimal operations that must be done, then traceback to find the way. i don't understand why this leads to AC. [cpp]case 3: printf("D%c%02d", d1[i-1], offset + i); traceBack(i - 1, j); --offset; break;[/cpp] this leads to infinit...
Sat Jul 24, 2004 9:14 am
Forum: Volume 1 (100-199)
Topic: 147 - Dollars
Replies: 233
Views: 24106
I use DP algorithm and got AC in 0.03 sec. if you want to use double or float make sure you + 0.5 before change it to int because precision of binary machine code i didn't use double or float [cpp] while (scanf("%d.%c%c", &input, &d1, &d2) == 3)[/cpp] just input the char hope it will help good luck
Sat Jul 24, 2004 5:33 am
Forum: Volume 104 (10400-10499)
Topic: 10405 - Longest Common Subsequence
Replies: 103
Views: 30749
I use DP LCS algorithm and got AC.
here it's input and output hope it can help those who get WA

[cpp] while (gets(d1))
{
gets(d2);
m = strlen(d1);
n = strlen(d2);
if (m == 0 || n == 0)
break;
// do the LCS
printf("%d\n", lcs[m][n]);
}[/cpp]
Sat Jul 24, 2004 5:25 am
Forum: Volume 101 (10100-10199)
Topic: 10192 - Vacation
Replies: 58
Views: 15338
I use normal DP LCS algorithm and got AC

BTW you should output "cities" although the answer is 1.
Sat Jul 24, 2004 5:20 am
Forum: Volume 100 (10000-10099)
Topic: 10053 - Envelopes
Replies: 12
Views: 3590
At first glance, m = 5 n = 10, i use brute force to get the answer but the judge said TLE. So i change the algorithm to backTrace and it got AC in 0.002 sec. :) it's a little difficult to decide whether a rectangle can put in anther one. be patient to caculate every cases . BTW i use double for the ...
Sat Jul 24, 2004 4:03 am
Forum: Volume 100 (10000-10099)
Topic: 10051 - Tower of Cubes
Replies: 19
Views: 9134
I use DP algorithm and AC in 0.3 sec. there is only max 100 colors memorize the max length for each color (making this color as bottom of the tower sequence) for the cube new coming for each top bottom pair put it after the top color(last cube's bottom color memorize in the array) see whether we can...
Sat Jul 24, 2004 3:34 am
Forum: Volume 101 (10100-10199)
Topic: 10100 - Longest Match
Replies: 95
Views: 21835
Got AC DP LCS not a difficult problem but you should pay attention to the special input otherwise you may get WA for many many times. input code [cpp] while (gets(line1) && gets(line2)) { m = strlen(line1); n = strlen(line2); if (m == 0 || n == 0)//for blank line if it exists { printf("%2d. Blank!\n...