Search found 28 matches

by subbu
Mon Oct 23, 2006 9:48 am
Forum: Volume 111 (11100-11199)
Topic: 11134 - Fabled Rooks
Replies: 12
Views: 6035

You can do it in O(NlogN). You can solve for the columns and rows independently, as you mentioned. For assigning the rooks to different columns, here is a hint, in the form of questions :) You can ignore 1 below, if you know an O(N^2) solution aleady. 1) Let x = how many rooks can be assigned to the...
by subbu
Tue Sep 26, 2006 8:30 pm
Forum: Volume 111 (11100-11199)
Topic: 11100 - The Trip, 2007
Replies: 18
Views: 14133

Your "max" calculation seems to be flawed.
The "max" variable will not be correct if the maximum value of counter occurs at the end of the array.

For example
on example
4
1 1 1 1

IIUC, max will be 1 according to your code; and not 4 as it should be.
by subbu
Tue Jan 03, 2006 12:51 am
Forum: Other words
Topic: ACM regionals and finals questions..
Replies: 29
Views: 13064

After going through misof's article, I had a thought about how judging can be done at the IOI to promote correctness ahead of heuristics. For each problem, have 3 or 4 different input files, each containing multiple test cases , each file testing a particular aspect of the solution. A solution will ...
by subbu
Wed Jun 16, 2004 12:13 pm
Forum: Volume 106 (10600-10699)
Topic: 10604 - Chemical Reaction
Replies: 24
Views: 15139

Ohh wait was that WA in 4 sec. The limit is 10 tubes right? I made such mistake once with a limit of 50,and it timed out. I forgot, mixing A with B need not be same as mixing B with A. for (int y=1;y<w;y++) for (int l=0;l<w;l++) if (y>l) if ((l==0)||(p[l]!=p[l-1])) this could be changed to reflect t...
by subbu
Wed Jun 16, 2004 11:48 am
Forum: Volume 106 (10600-10699)
Topic: 10604 - Chemical Reaction
Replies: 24
Views: 15139

I think this will timeout always no matter what encoding is used. If you look at it,in essence, you are trying to find the shortest path by DFS. The problem is that you are memoizing heats evolved in getting to a particular state from the start state, and redoing the calculation from this state to t...
by subbu
Wed Jun 16, 2004 11:17 am
Forum: Volume 106 (10600-10699)
Topic: 10604 - Chemical Reaction
Replies: 24
Views: 15139

What was your state encoding?
If i remember right, I used a single integer for the state for
memoization.
The first time,i used a vector<int> for the state and got TLE.
Thx,
Subra.
by subbu
Wed Jun 02, 2004 3:07 pm
Forum: Volume 106 (10600-10699)
Topic: 10658 - ReArrange
Replies: 16
Views: 5977

Got it now, i missed(??!!) the case n=0(my base cases were n=1 2 and 3) n=0 doesn't really make sense even though it is not forbidden by the input.I was misled by the statement that the numbering can be 1,2,3...,n interpreting that there was atleast 1 marble. I guess the input should be challenging ...
by subbu
Wed Jun 02, 2004 2:44 pm
Forum: Volume 106 (10600-10699)
Topic: 10658 - ReArrange
Replies: 16
Views: 5977

Those are exactly what i get,

can you provide output for

2
64
65

mine says :
7905747460161236406
15811494920322472813

Thanks,
subbu.
by subbu
Wed Jun 02, 2004 2:16 pm
Forum: Volume 106 (10600-10699)
Topic: 10658 - ReArrange
Replies: 16
Views: 5977

I interpret this problem as follows. Given 3 towers and n disks, 1,2,3,,,n separate the odd numbered disks from the even numbered disks standard towers of hanoi rules applying. My solution for this matches for n = 15(14043) Can anybody give outputs for the following: 10 1 2 3 4 5 6 7 8 9 10 Also my ...
by subbu
Thu Apr 08, 2004 1:47 pm
Forum: Volume 105 (10500-10599)
Topic: 10567 - Helping Fill Bates
Replies: 15
Views: 7801

to minskcity:

I am guessing you r doing the same thing as i am.

Try using the hint form of insertion into the set,to make it
constant time per insertion.
by subbu
Wed Mar 10, 2004 3:27 pm
Forum: Volume 100 (10000-10099)
Topic: 10094 - Place the Guards
Replies: 19
Views: 9541

http://online-judge.uva.es/board/viewtopic.php?t=1989&sid=27b745ed69e7ab27f183b15a1bad9239 u can look at this post. try reading some pattern. (it is not hard to find the pattern from the outputs provided by nick) i still can't find a pattern for numbers of the form 6K+2 or 6K+3 ( 8,9 ,14,15 ..). Fo...
by subbu
Mon Mar 08, 2004 10:46 am
Forum: Volume 100 (10000-10099)
Topic: 10094 - Place the Guards
Replies: 19
Views: 9541

I solved this problem by taking 2 cases. 1) N is *NOT* of the form 6K+2 or 6k+3 this case, i print the soln. directly. 2)N is of the form 6K+2 or 6K+3 For this case i ran a minimum conflicts local search and got AC in 5 sec. I am convinced that there is some general pattern for the case n = 6K+2 or ...
by subbu
Mon Mar 08, 2004 10:45 am
Forum: Volume 100 (10000-10099)
Topic: 10094 - Place the Guards
Replies: 19
Views: 9541

I solved this problem by taking 2 cases. 1) N is *NOT* of the form 6K+2 or 6k+3 this case, i print the soln. directly. 2)N is of the form 6K+2 or 6K+3 For this case i ran a minimum conflicts local search and got AC in 5 sec. I am convinced that there is some general pattern for the case n = 6K+2 or ...
by subbu
Fri Jan 30, 2004 11:57 am
Forum: Volume 106 (10600-10699)
Topic: 10617 - Again Palindrome
Replies: 12
Views: 5992

Count the number of palindromes that can be made out of subsets of the characters of the given string, maintaining the order(no permutations allowed). (same characters at different positions are considered different). For every palindrome u find in the above way, there is a unique way of scoring out...
by subbu
Mon Jan 26, 2004 5:21 am
Forum: Volume 106 (10600-10699)
Topic: 10616 - Divisible Group Sums
Replies: 39
Views: 19460

hey
Did u consider that modulo of a negative number is negative.

I made this mistake, using modulo of a negative number in
a array index.

good luk.

Go to advanced search