| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:TLE???why???In Reply To:TLE???why??? Posted by:swordl3 at 2012-07-08 17:34:34 > #include <stdio.h>
> #include <iostream>
> using namespace std;
> int main()
> {
> int i,n,q,a[500000],min,max,low,high;
> cin>>n>>q;
> for (i=0;i<n;i++)
> {
> cin>>a[i];
> }
> while(q--)
> {
> cin>>low>>high;
> min=100000;
> max=-100000;
> for(i=low-1;i<high;i++)
> {
> if(min>a[i])
> {
> min=a[i];
> }
> if(max<a[i])
> {
> max=a[i];
> }
> }
> cout<<(max-min)<<"\n";
> }
> return 0;
> }
Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator