Search found 15 matches

by gba356
Thu Nov 27, 2008 4:18 am
Forum: Volume 4 (400-499)
Topic: 490 - Rotating Sentences
Replies: 212
Views: 43088

Re: 490-Rotating sentence

Still your code generates incorrect output for the sample input.

Why did you ignore the spaces in the first column?

All you have to ignore are the spaces redundant at the end of the line.

This line may help you:

Code: Select all

freopen("out.txt","w",stdout);
Keep working:)
by gba356
Sun Nov 23, 2008 12:14 pm
Forum: Volume 4 (400-499)
Topic: 492 - Pig-Latin
Replies: 213
Views: 45850

Re: Time Limit Exceeded in 492. Why?

You should print '\n' after each line.

Also I'm not sure if a buffer with a size of 1000 would be enough..
by gba356
Sun Nov 23, 2008 3:31 am
Forum: Volume 4 (400-499)
Topic: 483 - Word Scramble
Replies: 122
Views: 35256

Re: plz help me 483

Hi, try this case(replace the asterisks with blank spaces): *ABC**DEF***GHIJK**** My AC solution gives me: *CBA**FED***KJIHG**** Where your code gives: CBA*FED*KJIHG* Also, you need a bigger buffer for the problem description didn't mention how long the input will be. An array with size of 90000 wou...
by gba356
Sun Nov 23, 2008 3:12 am
Forum: Volume 4 (400-499)
Topic: 490 - Rotating Sentences
Replies: 212
Views: 43088

Re: 490-why WA

Hi, your solution don't even pass the sample test cases. In the sample output we have: "R Ie *n te h* iD ne kc ,a *r tt he es r eo fn oc re e *s Ia *i ad m, . " where I replaced the blanks with asterisks. But your code gives: "R Ie *n te h* iD ne kc ,a *r tt he es r* eo fn oc re e* *s...
by gba356
Wed Oct 22, 2008 2:46 pm
Forum: Volume 115 (11500-11599)
Topic: 11504 - Dominos
Replies: 55
Views: 29720

Re: 11504 - Dominos

I changed and changed my algorithm for several times, but none of them succeeded to solve the problem :cry:

Can I have some hints?

This is driving me crazy!!
by gba356
Mon Oct 20, 2008 2:12 pm
Forum: Volume 115 (11500-11599)
Topic: 11504 - Dominos
Replies: 55
Views: 29720

Re: 11504 - Dominos

It may fail in some cases. For example, if you have the following graph: 3 nodes and these directed edges: <1, 2> <2, 1> and <3, 2> If you start the DFS at node 1 you will visit nodes 1 and 2. Then you will also knockdown tile 3, with total score 2 (Tiles 1 and 3). But the best solution is to just ...
by gba356
Fri Oct 17, 2008 3:01 pm
Forum: Volume 115 (11500-11599)
Topic: 11504 - Dominos
Replies: 55
Views: 29720

Re: 11504 - Dominos

Hi, I have been given constant WAs for the problem. First of all, I consider the dominos a directed graph. And I tried to approach the problem by DFS-ing through the nodes with no in-edge, and then DFS the nodes that are not visited , and then print the numbers of dominos knocked down by hand. I pas...
by gba356
Tue Feb 05, 2008 8:20 am
Forum: Volume 106 (10600-10699)
Topic: 10668 - Expanding Rods
Replies: 38
Views: 23904

I've used 1e-15 as my epislon, but the online judge system keeps give me constant WA. Can somebody check my code? I choose Bisection as my algo. #include<iostream> #include<cmath> #define e ( 1e-15 ) using namespace std; double L,n,C,S,S2,theta,r; inline double ABS( double x ) { return( x>0 ? x : -x...
by gba356
Thu Oct 25, 2007 5:50 pm
Forum: Volume 4 (400-499)
Topic: 442 - Matrix Chain Multiplication
Replies: 21
Views: 5569

I used STL to implement the stack. And for some reasons, my code is getting WA again and again; I wonder why...

Here's my code:

Code: Select all

Code deleted.
Wow, thanks for Jan's help. :D

But why can't I use the stack<char> one?
by gba356
Sun Oct 14, 2007 5:50 am
Forum: Volume 2 (200-299)
Topic: 216 - Getting in Line
Replies: 57
Views: 29994

I tried to solve the problem with DFS and some branch and bound, but it keeps give me WA. Could somebody help me? #include<iostream> #include<math.h> #define N 10 #define INF 214748647 #define Dist(i,j) sqrt( (x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]) ) using namespace std; int n,x[N],y[N]; int...
by gba356
Fri Jul 20, 2007 5:33 am
Forum: Volume 101 (10100-10199)
Topic: 10112 - Myacm Triangles
Replies: 13
Views: 6824

I got AC for problem 478, I'm using the same algo but it keeps WA, here's my code, it can't even pass the sample input, but it seems correct logically, can anyone help me??
Any comment is appreciated.

Code: Select all

Code deleted after AC, thanks for Jan's help!!!
:D :D :D
by gba356
Mon Jun 18, 2007 10:08 am
Forum: Volume 3 (300-399)
Topic: 371 - Ackermann Functions
Replies: 196
Views: 47512

I've tried a lot of inputs without no incorrect outputs. Can somebody give me some critical inputs or correct my code? I appreciate that. Code removed after AC. Missed the lines: L = the lower boundary value in the sequence H = the upper boundary value in the sequence Thanks for Rio's help!! :oops:
by gba356
Fri Jun 15, 2007 3:35 pm
Forum: Volume 4 (400-499)
Topic: 495 - Fibonacci Freeze
Replies: 222
Views: 53893

g++: Internal compiler error: program as got fatal signal 25

I sumitted my code by it gave me CE with error:

g++: Internal compiler error: program as got fatal signal 25

Huh? Signal 25?

Can somebody please help me?

Any help is appreciated^^

Code: Select all


Code removed after accepted with mf's help, thanks!!!

by gba356
Wed Jun 06, 2007 4:07 am
Forum: Volume 4 (400-499)
Topic: 412 - Pi
Replies: 104
Views: 28057

Thanks!

Thanks a LOT!!
I found my Prime() function cannot deal with the number 1, so I used another recursive GCD().

I got AC eventually, THANKS!! :D
by gba356
Tue Jun 05, 2007 5:58 pm
Forum: Volume 4 (400-499)
Topic: 412 - Pi
Replies: 104
Views: 28057

Here's my code......
It gave me the correct outputs for the inputs in the fourm, but still WA......
Can somebody help me please?
I appreciate that.

Code: Select all

Code removed after AC.
Thank you Jan!!

Go to advanced search