Search found 70 matches

by Timo
Sat Sep 30, 2006 4:17 am
Forum: Volume 9 (900-999)
Topic: 903 - Spiral of Numbers
Replies: 12
Views: 6926

I believe that something was wonrg with judge input and output. after 77 submission no one got AC??
I've made 2 program,one with formula,and the second one I simulate that spiral. The result of two my program are exactly the same.
I wonder why WE got Wrong Answer???
by Timo
Thu Sep 28, 2006 7:32 am
Forum: Volume 110 (11000-11099)
Topic: 11099 - Next Same-Factored
Replies: 24
Views: 10640

Hey,I Got WA for this problem,and I can't figure why my program got WA Removed after AC I found my bug,my calculation is overflow Ok,this is some test case,try it,Good Luck 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131...
by Timo
Wed Jul 19, 2006 6:40 am
Forum: Algorithms
Topic: need some easy bipartate matching problems
Replies: 2
Views: 1433

you can try this one:

10080 - Gopher II
by Timo
Wed May 24, 2006 2:30 pm
Forum: Volume 110 (11000-11099)
Topic: 11022 - String Factoring
Replies: 12
Views: 7129

My solution is use recursive with memo and I get 0:00.051.
I think you must optimize your dp.

:D
by Timo
Wed May 24, 2006 7:46 am
Forum: Volume 110 (11000-11099)
Topic: 11022 - String Factoring
Replies: 12
Views: 7129

it is 90% similiar to matrix chain multiplication problem

:D
by Timo
Fri May 19, 2006 1:56 pm
Forum: Algorithms
Topic: lower number
Replies: 2
Views: 1003

to temper_3243

"STL makes our life easier"

Code: Select all

#include <stdio.h>
#include <algorithm>

using namespace std;

int main()
{
	int x[]={1,4, 10, 15 , 20 , 30 };
	int *m,n=25;

	m = lower_bound(x,x+sizeof(x)/sizeof(int),n);
	printf("%d\n",*m==n ? *m: *(m-1));

	return 0;
}
Hope it helps :D
by Timo
Wed May 17, 2006 9:43 am
Forum: Volume 110 (11000-11099)
Topic: 11031 - Looking for a Subset
Replies: 24
Views: 17357

to C for convert from O(n^2) to O(n log(h) ) you can use the O(n log(h) ) LDS Algorithm. First time see this problem my algo is same with you O(n^2). But think a few minutes the inner loop can be replace by Binary Search. I think O(n^2) will give TLE, but I don't know it can get AC in 5 seconds. Hop...
by Timo
Fri May 12, 2006 1:50 pm
Forum: Volume 110 (11000-11099)
Topic: 11002 - Towards Zero
Replies: 39
Views: 17761

Hi asif_rahman0, I want try to help you :D . I will give you example from the sample input. .....[0][1][2][3] [0] 2 [1] 3 1 [2] -3 5 7 [3] 6 10 -2 20 [4] -7 -5 -8 [5] 10 8 [6] 7 let set(i,j) be the number that we can reach if we in the row i and column j. set(0,0) = {2} set(1,0) = {5,1} -> 5=|2+3|, ...
by Timo
Thu Apr 27, 2006 11:29 am
Forum: Volume 4 (400-499)
Topic: 485 - Pascal's Triangle of Death
Replies: 50
Views: 4935

I have test your program, compare your output with my AC output and it give the same result.

But I cannot explain to myself why your program get WA.
I will send my code for you by PM :wink:
by Timo
Thu Apr 27, 2006 11:06 am
Forum: Algorithms
Topic: Computing the partition function.
Replies: 11
Views: 1929

You can learn from my code, I think it's fast :D . It's ugly. Why do you use those macros? I know it's ugly, but it can make me type looping more faster :D. I like see: FOR(i,0,n) { } rather than: for(i=0;i<n;i++) { } I promise to you, next time when I post my code in this board I will type looping...
by Timo
Wed Apr 26, 2006 5:01 am
Forum: Algorithms
Topic: Computing the partition function.
Replies: 11
Views: 1929

You can learn from my code, I think it's fast :D . #include <stdio.h> #define MAX 120 int P[MAX+1]; int A[MAX+1]; int main() { int i,u,j,k; for(i=0;i<=MAX;i++) P[i]=1; for(u=2;u<=MAX;u++) { for(i=0;i<=MAX;i++) { A[i]=P[i]; P[i]=0; } for(j=0;j<=MAX;j+=u) for(k=j;k<=MAX;k++) P[k] += A[k-j]; } while(sc...
by Timo
Tue Apr 25, 2006 5:00 am
Forum: Volume 101 (10100-10199)
Topic: 10130 - SuperSale
Replies: 76
Views: 22645

Your DP algo for knapsack problem is same with me, but I think you should call it once.After that you can use the table many times. I can't help you to find where is your fault, but I assured your DP algo is right. I have change part of your code, this one should give AC. #include <stdio.h> #define ...
by Timo
Tue Apr 25, 2006 4:45 am
Forum: Volume 102 (10200-10299)
Topic: 10200 - Prime Time
Replies: 202
Views: 61644

I think for this problem not need to generate up to 10^8 prime, but only 10^4 prime.
:D
by Timo
Mon Apr 24, 2006 8:26 am
Forum: Algorithms
Topic: bisection or something else..
Replies: 15
Views: 2935

yeah you are right :D . how about this one let Pab = middlePoint(A,B) let Pac = middlePoint(A,C) let Pbc = middlePoint(B,C) Pab, Pac, Pbc can be candidate of D. after that : E = Pab, F=Pac, G=Pbc let Pef = middlePoint(E,F) let Peg = middlePoint(E,G) let Pfg = middlePoint(F,G) Pef, Peg, Pfg can be ca...
by Timo
Mon Apr 24, 2006 7:50 am
Forum: Volume 102 (10200-10299)
Topic: 10200 - Prime Time
Replies: 202
Views: 61644

you don't have to generate up to 100000000 prime.
Only sqrt(100000000) = 10000 prime

:D

Go to advanced search