标签:div algo open pac names main freopen string 分享
只是一个目的:$zkw Get!$
1 #include<iostream> 2 #include<cstdio> 3 #include<algorithm> 4 #include<cstring> 5 using namespace std; 6 const int maxn=(131072<<1)+10; 7 int n,m,q,minn[maxn]; 8 int haha() 9 { 10 freopen("faithful.in","r",stdin); 11 freopen("faithful.out","w",stdout); 12 scanf("%d%d",&n,&q); 13 for(m=1;m<n+2;m<<=1); 14 for(int i=1;i<=n;i++)scanf("%d",&minn[i+m]); 15 for(int i=m-1;i;i--)minn[i]=min(minn[i<<1],minn[i<<1|1]); 16 while(q--) 17 { 18 int x,y;scanf("%d%d",&x,&y); 19 int ans=2147483647; 20 x=x+m-1,y=y+m+1; 21 for(;x^y^1;x>>=1,y>>=1) 22 { 23 if(!(x&1))ans=min(ans,minn[x^1]); 24 if(y&1)ans=min(ans,minn[y^1]); 25 } 26 printf("%d\n",ans); 27 } 28 } 29 int sb=haha(); 30 int main(){;}
标签:div algo open pac names main freopen string 分享
原文地址:http://www.cnblogs.com/Loser-of-Life/p/7291334.html