preprocessing is not at all a bad thing.There are certain problems where you
can avoid TLE by preprocessing only.Examples include doing RMQ.
But for this particular problem you are solving for all possible test cases
only few of which actually occur,Moreover there is no big advantage drawn
from pre
thanks legobut why preprocessing all time avoided??
any drawback of it?
--
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 unsubscribe from this group, send email to
Also make sure you don't write this code during a technical interview
... allocating 8 million bytes on the stack is not the way to go.
On Tuesday, June 7, 2011, saurabh singh wrote:
> For all those who are still stuck with TLE,dont preprocess.The test data is
> not that large and the time limit
For all those who are still stuck with TLE,dont preprocess.The test data is
not that large and the time limit small.Just compute each query as it
arrives.I got AC this way only
On Tue, Jun 7, 2011 at 6:01 PM, kartik sachan wrote:
> https://www.spoj.pl/problems/ETF/
> vase saurabh bhai mere ho gya
https://www.spoj.pl/problems/ETF/
vase saurabh bhai mere ho gya..
--
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 unsubscribe from this group, send email to
algo
Can sum1 plz give me the link to the problem?
2011/6/5 keyan karthi
> also tc page tat arun said says as follows...
>
>
>1. If *p* is prime, then φ (*p*) = *p* - 1 and φ (*pa*) = *p** a* * (1
>- 1/*p*) for any *a*.
>2. If *m* and *n* are coprime, then φ (*m* * *n*) = φ (*m*) * φ (*n*)
also tc page tat arun said says as follows...
1. If *p* is prime, then φ (*p*) = *p* - 1 and φ (*pa*) = *p** a* * (1 -
1/*p*) for any *a*.
2. If *m* and *n* are coprime, then φ (*m* * *n*) = φ (*m*) * φ (*n*).
3. If *n* = , then Euler function can be found using formula:
φ (*n*) = *n
dude.. u code says pi(3) =3 as its a prime... but pi(3) is 2
in the same way pi(2)=2 as per ur code.. but ans is 1... mend ur code for
this... :)
On Sun, Jun 5, 2011 at 9:20 PM, kartik sachan wrote:
> @keyan then also it is given time limit exceed
> i don't know what to do.
@keyan then also it is given time limit exceed
i don't know what to do..plzz help me plz
my modified code is :
# include
int main()
{
long long int phi[101];
long long int i,j,t1,k;
scanf("%lld",&t1);
while(t1--)
{
scanf("%lld",&k);
phi[1]=1;
for ( i=
first time when i pre processed, my code timed out :P on calling it for
every loop iteration my code passed !! may be tats the problem...
On Sun, Jun 5, 2011 at 1:56 AM, kartik sachan wrote:
> @arun.i got nothing from this link becoz i have made the
> program from that concept
@arun.i got nothing from this link becoz i have made the program
from that concept...give me some other hints..
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googleg
read topcoder tutotial
http://www.topcoder.com/tc?module=Static&d1=tutorials&d2=primeNumbers
hope will be useful
On Fri, Jun 3, 2011 at 5:33 PM, kartik wrote:
> what's worng in my code..why the judge is giving
> TLE.plzz help me out
> my code is
> # include
> int main()
> {
>
what's worng in my code..why the judge is giving
TLE.plzz help me out
my code is
# include
int main()
{
long long int phi[101];
long long int n=100,k,i,j;
phi[1]=1;
for ( i=2; i<=n; ++i) phi[i]=i;
for ( i=2; i<=n; ++i)
if (phi[i]==i) // prime
for ( j=i; j<
13 matches
Mail list logo