Search found 74 matches
- Fri Dec 31, 2010 11:44 am
- Forum: Volume 9 (900-999)
- Topic: 922 - Rectangle by the Ocean
- Replies: 3
- Views: 3802
Re: 922 - Rectangle by the Ocean
O(n^2 log n) is enough for the problem.Take two point and find the other two . Then check two point from the map in log n.
- Mon Nov 15, 2010 5:40 pm
- Forum: Volume 110 (11000-11099)
- Topic: 11081 - Strings
- Replies: 35
- Views: 23810
Re: 11081 - Strings
@kbr_iut
iterative dp is faster with same approach.
run time reduced to 0.256 from 1.088 sec.
iterative dp is faster with same approach.
run time reduced to 0.256 from 1.088 sec.
- Sun Nov 14, 2010 6:17 am
- Forum: Volume 109 (10900-10999)
- Topic: 10931 - Parity
- Replies: 18
- Views: 12469
Re: 10931 - Parity
hello ghana, ![;)](./images/smilies/icon_wink.gif)
change ur pointer calculation
use code tags while posting code
![;)](./images/smilies/icon_wink.gif)
change ur pointer calculation
Code: Select all
char bin[50];
void calculate(int n)
{
- Sun Nov 14, 2010 5:46 am
- Forum: Volume 118 (11800-11899)
- Topic: 11838 - Come and Go
- Replies: 22
- Views: 10759
Re: 11838 - Come And Go
your implementation of tarjans algorithm is not correct. see http://en.wikipedia.org/wiki/Tarjan's_strongly_connected_components_algorithm there are some pop operations you are missing int pp; void tarjan( int x ){ ind[ x ] = c; low[ x ] = c; c ++; node.push( x ); for( int i = 1; i <= N; i ++ ){ if(...
- Sun Nov 14, 2010 5:31 am
- Forum: Volume 118 (11800-11899)
- Topic: 11858 - Frosh Week
- Replies: 20
- Views: 6389
Re: 11858 - Frosh Week
use long long to avoid wa
- Thu Nov 11, 2010 4:04 am
- Forum: Volume 110 (11000-11099)
- Topic: 11086 - Composite Prime
- Replies: 33
- Views: 21646
Re: 11086 - Composite Prime
219760
- Thu Nov 04, 2010 7:58 am
- Forum: Volume 118 (11800-11899)
- Topic: 11857 - Driving Range
- Replies: 21
- Views: 10759
Re: 11857 - Driving Range
thanks ![:)](./images/smilies/icon_smile.gif)
![:)](./images/smilies/icon_smile.gif)
- Thu Nov 04, 2010 4:39 am
- Forum: Volume 118 (11800-11899)
- Topic: 11857 - Driving Range
- Replies: 21
- Views: 10759
- Fri Sep 24, 2010 8:47 am
- Forum: Volume 118 (11800-11899)
- Topic: 11843 - Guessing Game
- Replies: 10
- Views: 4667
Re: 11843 - Guessing Game
you can precalculate on ans
then just chek ar[s][k]>=N then output k
Code: Select all
for(i=1;i<21;i++)
{
ar[i][1]=1;
ar[1][i]=i;
}
for(i=2;i<21;i++)
{
for(j=2;j<=55;j++)
{
ar[i][j]=1+ar[i-1][j-1]+ar[i][j-1];
}
}
- Fri Sep 17, 2010 7:03 am
- Forum: Volume 109 (10900-10999)
- Topic: 10913 - Walking on a Grid
- Replies: 23
- Views: 14273
Re: 10913 - Walking on a Grid
my code passes all the cases of forum , but still i am getting wa ,pls help :oops: :oops: #include<stdio.h> #include<iostream> using namespace std; long long dp[80][80][10]; long long grid[80][80]; long long b[80][10]; long long c[80][10]; int n,k; int main() { int tst=0,i,j,l; long long INF=9000000...
- Tue Sep 14, 2010 11:09 pm
- Forum: Volume 116 (11600-11699)
- Topic: 11645 - Bits
- Replies: 9
- Views: 5287
Re: 11645 - Bits
dp dimension is [length][stateOfNo][lastBit][AnyAdjacentOne] ,it will return how many nos having 11 pattern,
stateOfNo is whether it is <=N
AnyAdjacentOne is whether 11 occurs or not
Using this you can calculate number of 11s using another 4d BigIntArray
stateOfNo is whether it is <=N
AnyAdjacentOne is whether 11 occurs or not
Using this you can calculate number of 11s using another 4d BigIntArray
- Tue Sep 14, 2010 7:03 am
- Forum: Volume 105 (10500-10599)
- Topic: 10541 - Stripe
- Replies: 10
- Views: 6336
Re: 10541 - Stripe
@ Piotr42
you can solve it using dp
dimension is [n][k];
you can solve it using dp
dimension is [n][k];
- Mon Sep 13, 2010 1:19 pm
- Forum: Volume 113 (11300-11399)
- Topic: 11391 - Blobs in the Board
- Replies: 10
- Views: 5952
- Fri Sep 10, 2010 2:47 pm
- Forum: Volume 116 (11600-11699)
- Topic: 11658 - Best Coalitions
- Replies: 7
- Views: 4503
- Fri Sep 10, 2010 1:33 pm
- Forum: Volume 109 (10900-10999)
- Topic: 10910 - Marks Distribution
- Replies: 26
- Views: 16608
Re: 10910 - Marks Distribution
i got wa in this code,but when i switched to java ,in same process i got ac
this is the wa code
this is the wa code
Code: Select all
code removed...