Search found 161 matches

by ayon
Mon Oct 23, 2006 3:55 pm
Forum: Volume 103 (10300-10399)
Topic: 10311 - Goldbach and Euler
Replies: 98
Views: 23251

if you know bitwise operation in C, it will be rather easy using char array as sunny said. better process is using char array of size[MAX/16]. it deals with only odd numbers, as you know even numbers are not prime(except 2). 1st character of the char array represents whether 1, 3, 5, 7, 9, 11, 13, 1...
by ayon
Mon Oct 23, 2006 1:01 am
Forum: Volume 110 (11000-11099)
Topic: 11097 - Poor My Problem! :-(
Replies: 8
Views: 5678

can anyone give me the output for the following input?

4 4 0
0 1 100
1 2 1
2 3 1
3 1 1
4
0
1
2
3
by ayon
Sat Oct 21, 2006 10:48 pm
Forum: Off topic (General chit-chat)
Topic: I win !!
Replies: 361
Views: 123970

coolguy wrote:Im da winner Now :) anyone dare to challenge me :D
u can see..., if there anyone or not
by ayon
Sat Oct 21, 2006 10:38 pm
Forum: Volume 103 (10300-10399)
Topic: 10311 - Goldbach and Euler
Replies: 98
Views: 23251

isn't it very simple? ur prim[] array is taking more than 47MB, where the judge memory limit is 32MB
by ayon
Fri Sep 15, 2006 2:53 pm
Forum: Volume 110 (11000-11099)
Topic: 11076 - Add Again
Replies: 34
Views: 16501

avoid floating point number where possible, if you are bound to use floating point number, do not write code like d != 1, as 5.00/5.00 may return 0.99999999 or 1.0000000001 or something like this.
by ayon
Sun Sep 10, 2006 9:14 pm
Forum: Volume 110 (11000-11099)
Topic: 11084 - Anagram Division
Replies: 19
Views: 9421

isn't that the straight forward backtracking process takes O(n!) time, where n is the length of s ? i first submitted O(n!) solution and got tle, then reading adrian kuegel's post i sent a DP solution with bitmask which runs in O(n*d*2^n) time and got accepted in 0.6xx sec. but with simple observati...
by ayon
Tue Sep 05, 2006 8:37 pm
Forum: Volume 110 (11000-11099)
Topic: 11078 - Open Credit System
Replies: 12
Views: 6016

I faced the same problem at real-time contest held somedays ago at our country. I thought the first line of input is the n for the 1st test case and got two runtime error(might be array was indexed with negative number), we then requested a clarification about he 1st line of input, but we were not a...
by ayon
Mon Sep 04, 2006 8:43 pm
Forum: Volume 110 (11000-11099)
Topic: 11082 - Matrix Decompressing
Replies: 28
Views: 12362

sclo wrote:you can also subtract C from each row sum, and R from each column sum.
ya i did exactly that, and assigned capacity 19 to each row->column, both have the same meaning
by ayon
Mon Sep 04, 2006 8:35 pm
Forum: Volume 110 (11000-11099)
Topic: 11083 - Zeroes Revisited
Replies: 13
Views: 6475

first loop O(sqrt(b)) to get the maximum prime factor p of b,
second loop to run the formula in O(logn/logp) time
thats all i did

temper_3243: i sent my code
by ayon
Sun Sep 03, 2006 10:33 pm
Forum: Volume 110 (11000-11099)
Topic: 11083 - Zeroes Revisited
Replies: 13
Views: 6475

try the inputs:
0 2
1 2
4000000000 2
4000000000 81510
0 0

output from my ac program:
0
0
7999999938612287475
444444430281766415

by the way it's not necessary to generate the primes, my program runs in 0.008 sec and it is only 5-6 line.
by ayon
Sun Sep 03, 2006 9:08 pm
Forum: Algorithms
Topic: algorithm to determine that polygon is star-shaped
Replies: 7
Views: 2712

if any vertex has been left outside the border of constructed convex plygon.
there shouldn't be any vertices left outside of the convex hull
by ayon
Sun Sep 03, 2006 7:42 pm
Forum: Volume 110 (11000-11099)
Topic: 11082 - Matrix Decompressing
Replies: 28
Views: 12362

solved the problem. i flowed 1 unit through all row -> column edge before running ford-fulkerson
by ayon
Sun Sep 03, 2006 6:53 pm
Forum: Volume 110 (11000-11099)
Topic: 11082 - Matrix Decompressing
Replies: 28
Views: 12362

matrix entry range [1,20], so i assign capacity 20 to each edge joining row and column, but how to tackle the lower part, if i run simple ford-fulkerson, any matrix entry could be 0, but i have to take care about it, please help me
by ayon
Sun Aug 27, 2006 7:46 pm
Forum: Volume 109 (10900-10999)
Topic: 10920 - Spiral Tap
Replies: 12
Views: 7272

i did it O(1) , the upper right corners are all square of consecutive odd numbers(1 9 25 49 81 etc.). i first sqrt the number and get in which interval the number lies(i.e 40 lies in the interval [25, 49) ) four straight lines connect 25 and 49, then it's easy to find in which line, in which positio...
by ayon
Wed Aug 23, 2006 11:10 pm
Forum: Volume 108 (10800-10899)
Topic: 10806 - Dijkstra, Dijkstra.
Replies: 24
Views: 17911

misof's test case says 6 8 1 2 1 2 3 1 3 6 1 1 4 100 4 5 100 5 6 100 1 3 10 2 6 10 if we flow from 1 to 6, maxflow will be 3(i assigned capacity 1 to each edges), there is no way to remove 1-3 or 2-6 at step 3. at step 3 only edge 2-3 will be deleted as no flow occured in edge 2-3, and by running di...

Go to advanced search