http://www.spoj.pl/problems/THRBL/
my code is
i am getting TLE
# include<iostream>
# include<cstdio>
using namespace std;
//int search(long long int [],long long )
int main()
{
while(1)
{
int n,m;
int count=0;
long long int a[50010]={0};
int b[50010],c[50010];
if((scanf("%d%d",&n,&m))==EOF)
break;
int i;
for(i=0;i<n;i++)
cin>>a[i];
for(i=0;i<m;i++)
cin>>b[i]>>c[i];
int j;
int flag=0;
for(i=0;i<m;i++)
{
for(j=(b[i]-1);j<(c[i]-1);j++)
if(a[(b[i]-1)]<a[j])
{
flag=1;
break;
}
if(flag==0)
count++;
flag=0;
}
cout<<count<<endl;
}
return 0;
}
why i am getting TLE...............can anyone explain
this...................plzzzzzzzzzz
--
*WITH REGARDS,*
*
*
*KARTIK SACHAN*
*B.TECH 2ND YEAR*
*COMPUTER SCIENCE AND ENGINEERING*
*NIT ALLAHABAD*
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.