https://www.spoj.pl/problems/MAXSUMSQ/
Hi in above problem , i am getting TLE but according to given contraints ,
i think my code is good enough to run. Can any body help me here
#include
#include
#include
#include
#include
#include
#include
#include
#include
#define VI vector
typede
---
Bhavesh agrawal wants to stay in better touch using some of Google's coolest new
products.
If you already have Gmail or Google Talk, visit:
http://mail.google.com/mail/b-b4f0875ca2-29d66a53f9-Tt0nFfpQ80JaH-2cWOceg6RZIxQ
You'l
You cn also use modified BFS with mappings from numbers to its
corresponding paths and print the paths from the root.
On Mar 12, 7:45 am, xyz69 wrote:
> Number 1, doesn't represent any letter.
>
> pseudocode, (numbers is array of numbers, currentString is currently
> composed string to show)
>
>
https://www.spoj.pl/problems/STREETR/
On 3/12/11, kumar anurag wrote:
> which probem ? pls gve the link
> On Sat, Mar 12, 2011 at 8:27 PM, Akshata Sharma
> wrote:
>
>> yeah I too got AC. The way I was calculating gcd was not efficient. :)
>>
>> On 3/12/11, Logic King wrote:
>> > Here is my s
which probem ? pls gve the link
On Sat, Mar 12, 2011 at 8:27 PM, Akshata Sharma
wrote:
> yeah I too got AC. The way I was calculating gcd was not efficient. :)
>
> On 3/12/11, Logic King wrote:
> > Here is my solution.i got it AC
> >
> > #include
> > int gcd(int a, int b)
> > { int temp
yeah I too got AC. The way I was calculating gcd was not efficient. :)
On 3/12/11, Logic King wrote:
> Here is my solution.i got it AC
>
> #include
> int gcd(int a, int b)
> { int temp;
>while(b)
>{
>temp = a % b;
>a = b;
>b = temp;
>
Here is my solution.i got it AC
#include
int gcd(int a, int b)
{ int temp;
while(b)
{
temp = a % b;
a = b;
b = temp;
}
return(a);
}
int main()
{
int n,i,min,ans=0;
scanf("%d",&n);
int arr[n],ard[n];
ard[0]=1;
if(n>0)
sc
Yeah, I too am wondering how to implement more efficiently.
On Sat, Mar 12, 2011 at 7:36 PM, Satyam Kapoor wrote:
>
>
> @balaji:i hve got ac with gcd method but the time is 0.32 sec
> best soln is 0.03
> how is that achievable?
> --
> Satyam Kapoor
> B.Tech 2nd year
> Computer Science And Enginee
@balaji:i hve got ac with gcd method but the time is 0.32 sec
best soln is 0.03
how is that achievable?
--
Satyam Kapoor
B.Tech 2nd year
Computer Science And Engineering
M.N.N.I.T ALLAHABAD
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To
@Akshata, Satyam: I think that might be because the way you are using to
calculate gcd is inefficient.
I got AC.
I used the following technique to calculate gcd:
long long int gcd(long long int a, long long int b){
long long int rem = a%b;
if(rem == 0) return b;
return gcd(b,rem);
}
long
@Balaji:
that WA was due to using int in place of long long in loop. But still, this
is giving TLE.
On Sat, Mar 12, 2011 at 7:07 PM, Akshata Sharma
wrote:
> sorry, @satyam: then what is the 'best' solution for this? :)
>
>
> On Sat, Mar 12, 2011 at 7:06 PM, Akshata Sharma > wrote:
>
>> @Ankur: th
@akshata:i did this one by hcf method but it took too much time...
--
Satyam Kapoor
B.Tech 2nd year
Computer Science And Engineering
M.N.N.I.T ALLAHABAD
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to al
sorry, @satyam: then what is the 'best' solution for this? :)
On Sat, Mar 12, 2011 at 7:06 PM, Akshata Sharma
wrote:
> @Ankur: then what is the 'best' solution for this? :)
> @Balaji: i tried implementing but I dont know which case it fails?? getting
> WA now!!
> Here is the code:
>
> #include
>
@Ankur: then what is the 'best' solution for this? :)
@Balaji: i tried implementing but I dont know which case it fails?? getting
WA now!!
Here is the code:
#include
int main()
{
long n,gcd=1;
scanf("%d",&n);
long long a[n],b[n],cnt=0,sum=0;
long long min=9;
scanf("%lld",&a[0]);
fo
Number 1, doesn't represent any letter.
pseudocode, (numbers is array of numbers, currentString is currently
composed string to show)
function printChar(numbers, currentString){
for (every letter coded as numbers[0]){
if (numbers.lenght>1){
printChar(numbers[1:], currentString+letter)
this is gud but not the best soln.
--
Satyam Kapoor
B.Tech 2nd year
Computer Science And Engineering
M.N.N.I.T ALLAHABAD
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To uns
Find the gcd of n-1 differences ( a[1]..a[n-1] with a[0] )
ans = (a[n-1] - a[0])/gcd - n + 1
Thanks,
Balaji.
On Sat, Mar 12, 2011 at 2:00 PM, Akshata Sharma
wrote:
> Any faster way to solve this problem??
>
> On 3/12/11, Balaji Ramani wrote:
> > Yes, the correct answer is 0.
> >
> > "if(flag =
Any faster way to solve this problem??
On 3/12/11, Balaji Ramani wrote:
> Yes, the correct answer is 0.
>
> "if(flag ==0 || ans ==0)" i think can be changed to "if(flag ==0)" alone.
>
> Thanks,
> Balaji.
>
> On Sat, Mar 12, 2011 at 10:16 AM, Satyam Kapoor
> wrote:
>
>> is case main answer 0 hona
18 matches
Mail list logo