Well, it seems this problem has O(n)solution at best - > number of sums = n/x, where x is a product of function F(n), F(n) is not linear, more of a combination of linear and logarithmic function.
There might be a faster solution, but cba to find it :p
Search found 7 matches
- Sat Nov 29, 2008 2:51 pm
- Forum: Volume 115 (11500-11599)
- Topic: 11526 - H(n)
- Replies: 49
- Views: 24754
- Sat Nov 29, 2008 12:22 am
- Forum: Volume 115 (11500-11599)
- Topic: 11526 - H(n)
- Replies: 49
- Views: 24754
Re: 11526 - H(n)
From my analysis there may be a logn solution...i will post again soon
- Wed Nov 19, 2008 12:13 pm
- Forum: C++
- Topic: Runtime error - don't know why
- Replies: 1
- Views: 5066
Re: Runtime error - don't know why
check if there can be cases causing your algo to divide by zero, for a start...in your case...
ordLen != 0
expLen != 0
ordLen != -expLen
Also your fucntion "int addTrain(int queue[], int &pos, int leave)"...first parameter does not refer to any global array of ints, nor does it work with any array ...
ordLen != 0
expLen != 0
ordLen != -expLen
Also your fucntion "int addTrain(int queue[], int &pos, int leave)"...first parameter does not refer to any global array of ints, nor does it work with any array ...
- Tue Nov 18, 2008 4:17 pm
- Forum: Volume 3 (300-399)
- Topic: 355 - The Bases Are Loaded
- Replies: 74
- Views: 30574
Re: 355 - The Bases Are Loaded
Try to change
while (scanf("%d %d %s", &oriBase, &newBase, &oriValue))
to
while (scanf("%d %d %s", &oriBase, &newBase, &oriValue)==3)
while (scanf("%d %d %s", &oriBase, &newBase, &oriValue))
to
while (scanf("%d %d %s", &oriBase, &newBase, &oriValue)==3)
- Tue Nov 18, 2008 3:20 pm
- Forum: Volume 3 (300-399)
- Topic: 390 - Letter Sequence Analysis
- Replies: 4
- Views: 3999
Re: 390 -> wrong sample output and wrong PE judgement
This is so simple problem...yet i keep getting WA no matter what i do, while in my tests, there are no mistakes :-?
The frequencies and words belonging to them are correct so i guess there is either a mistake in my formatting or in the way i read data...
My output has this format.
Analysis for ...
The frequencies and words belonging to them are correct so i guess there is either a mistake in my formatting or in the way i read data...
My output has this format.
Analysis for ...
- Wed Oct 15, 2008 6:38 pm
- Forum: Volume 109 (10900-10999)
- Topic: 10954 - Add All
- Replies: 80
- Views: 41629
Thank you
Thanks mf,
Yes you are quite right i do not understand how memory works, i knew that functions free memory of their local variables when they finish, but didnt know it aplies to cycles aswell(and at the same time i use for(){} regularly, i am dumb :D)
About reinventing the wheel, you are right. But ...
Yes you are quite right i do not understand how memory works, i knew that functions free memory of their local variables when they finish, but didnt know it aplies to cycles aswell(and at the same time i use for(){} regularly, i am dumb :D)
About reinventing the wheel, you are right. But ...
- Wed Oct 15, 2008 5:20 pm
- Forum: Volume 109 (10900-10999)
- Topic: 10954 - Add All
- Replies: 80
- Views: 41629
Runtime Error problem,
Hello there,
i am new to the whole c++ language and now i hit a problem i am not able to figure out.
It appeared to me while i tried to solve 10954-Add All problem. Everything worked on my computer and my code solved all test cases i could think off in no time and correctly. But when i submitted ...
i am new to the whole c++ language and now i hit a problem i am not able to figure out.
It appeared to me while i tried to solve 10954-Add All problem. Everything worked on my computer and my code solved all test cases i could think off in no time and correctly. But when i submitted ...