## Search found 103 matches

Tue Jun 29, 2010 12:30 pm
Forum: Volume 110 (11000-11099)
Topic: 11081 - Strings
Replies: 35
Views: 20340

### Re: 11081 - Strings

my runtime is 1.728 sec. I saw runtime like 0.152 sec in ranklist. Those who got better runtime ,can u share ur idea.
my dp is 3*N^3 with 4 recursive calls.
I think there is inclusion exclusion approach,,Have anyone found out?

Mon Jun 28, 2010 1:14 am
Forum: Volume 106 (10600-10699)
Topic: 10604 - Chemical Reaction
Replies: 24
Views: 15475

### Re: 10604 - Chemical Reaction

I tried with 6 dimensional dp (each dimension is of size 10) and unexpectedly I got AC in 0.064 seconds. I thought this would time out because I need some extra 6*6 calculations inside dp recurrence. Later I understood it, noticing the limit of k. "asmaamagdi" wrote, Can any1 plz provide s...
Thu Jun 10, 2010 1:55 pm
Forum: Volume 108 (10800-10899)
Topic: 10891 - Game of Sum
Replies: 33
Views: 13668

### Re: 10891 - Game of Sum

polone wrote,
the dp should be O(n^3)
mine is O(N^2)
Sat Dec 19, 2009 9:14 pm
Forum: Volume 111 (11100-11199)
Topic: 11125 - Arrange Some Marbles
Replies: 20
Views: 14921

### Re: 11125 - Arrange Some Marbles

I coded with 8 dimensional ugly memoized solution and got TLE.....how 8 dimension gets AC? or am I missing something here is my code. #include<iostream> #include<string.h> #include<algorithm> #include<numeric> #include<vector> using namespace std; int sum,r,n,N,R,C,t,txt; typedef vector<int> vi; typ...
Tue Jul 07, 2009 5:58 pm
Forum: Volume 113 (11300-11399)
Topic: 11349 - Symmetric Matrix
Replies: 43
Views: 20959

### Re: 11349 - Symmetric Matrix

I just copied ur code and run for sample input of this problem and ur code gives

Code: Select all

``````Test #1: Symmetric.
Test #2: Symmetric.
``````

and try to use code tag to post codes.
Mon Jul 06, 2009 6:28 pm
Forum: Volume 101 (10100-10199)
Topic: 10115 - Automatic Editing
Replies: 29
Views: 10308

### Re: 10115 - Automatic Editing

input 5 a n b k nk m mmmm i kmkkknmkknn am ababababbabbbbaabbbaa 4 p a q j x n aaa a qpppppppppppppppppppppppx 0 my AC code gives iam jan Obaida wrote can any one explain this output of jan here r the steps. 1)replace all p with a qpppppppppppppppppppppppx -> qaaaaaaaaaaaaaaaaaaaaaaax 2)replace aaa ...
Fri Jul 03, 2009 1:18 am
Forum: Volume 113 (11300-11399)
Topic: 11349 - Symmetric Matrix
Replies: 43
Views: 20959

### Re: 11349 - Symmetric Matrix

U need to read the input carefully. suppose input is like 1 N = 3 first, u r taking 1 with scanf ("%d", &num_test); that is okay. then u r using scanf ("%c %c %d", &junk, &junk, &n); Can u tell what will be the valu of junk and n here? junk='\n' junk='N' n=garbage...
Sat May 23, 2009 10:11 pm
Forum: Volume 104 (10400-10499)
Topic: 10453 - Make Palindrome
Replies: 38
Views: 16289

### Re: 10453 - Make Palindrome

To solve this problem I got help from topcoder explanation...I tried it in two approach.both of them are giving TLE 1) DP approach. #include<iostream> #include<string> using namespace std; string MakePalindrom(string base){ string best[1002][1002]; int len=base.length(); if(len<=1)return base; for(i...
Fri Apr 03, 2009 7:37 pm
Forum: Volume 112 (11200-11299)
Topic: 11219 - How old are you?
Replies: 117
Views: 35931

### Re: 11219 - How old are you?

try this

input:

Code: Select all

``````1
1/3/2000
29/2/2000``````
output:

Code: Select all

``Case #1: 0``
ur code gives

Code: Select all

``Case #1: Invalid birth date``
Tue Mar 03, 2009 9:59 pm
Forum: Volume 115 (11500-11599)
Topic: 11503 - Virtual Friends
Replies: 49
Views: 19167

### Re: 11503 - Virtual Friends

I got Acc in 2.920 sec , how can i reduce time of my algo ? I use union-find and map Mine took 6.49 sec.I also used union-find algo and map......I am asking u how urs took such a shorter time. I saw somene getting AC in more shorter time in statistics. If u need to check my code, tell me. I will pm...
Fri Feb 27, 2009 2:51 am
Forum: Volume 115 (11500-11599)
Topic: 11503 - Virtual Friends
Replies: 49
Views: 19167

### Re: 11503 - Virtual Friends

This problem is solvable with union-find algorithm.
I didnt see ur code.
but ur code fails to give correct answer for the input posted by "roticv "
input

Code: Select all

``````1

5
A B
B C
D E
A D
A C``````
output

Code: Select all

``````2
3
2
5
5``````
but ur code gives

Code: Select all

``````2
3
5
5
5``````
hope it will help out.
Wed Feb 25, 2009 2:47 pm
Forum: Volume 115 (11500-11599)
Topic: 11572 - Unique Snowflakes
Replies: 36
Views: 13914

### Re: 11572 - Unique Snowflakes

Thanx Jony vi, at last I got the point and got AC in 1.10 second. This problem drove me crazy. But the logic is too simple.
Tue Feb 24, 2009 6:56 pm
Forum: Volume 115 (11500-11599)
Topic: 11572 - Unique Snowflakes
Replies: 36
Views: 13914

### Re: 11572 - Unique Snowflakes

I am sorry.
i am not getting ur point.
if i dont initialize map every time how cud i determine the identical numbers.
suppose.
1 2 3 2 4 5
if i dont initialize my map ....then i will get map[2]>0 in the colored portion.so i havnt any idea to minimize the TL.
I am so stupid.
Tue Feb 24, 2009 6:02 pm
Forum: Volume 115 (11500-11599)
Topic: 11572 - Unique Snowflakes
Replies: 36
Views: 13914

### Re: 11572 - Unique Snowflakes

sapnil wrote:

Code: Select all

``````1
6
1 2 3 2 4 5``````
Output is:4

i dont have any idea to pass the TL.
can u pliz share ur method.
Tue Feb 24, 2009 5:25 pm
Forum: Volume 115 (11500-11599)
Topic: 11572 - Unique Snowflakes
Replies: 36
Views: 13914

### Re: 11572 - Unique Snowflakes

thanx Jony vi(sapnil_sust) and Moshiur Rahman. but this time I cant pass TL. can u pliz again help me? #include<iostream> #include<map> using namespace std; int num,t,i,j,n,tem,ar[100010]; int main(){ #ifndef ONLINE_JUDGE freopen("1.txt","r",stdin); #endif scanf("%d",&a...