比赛 |
Segment Tree Competition |
评测结果 |
AAAAAAAATT |
题目名称 |
延绵的山峰 |
最终得分 |
80 |
用户昵称 |
零度阳光 |
运行时间 |
2.853 s |
代码语言 |
C++ |
内存使用 |
4.10 MiB |
提交时间 |
2016-08-28 20:50:29 |
显示代码纯文本
#include<stdio.h>
#include<stdlib.h>
int a[1000001],i,j,k,m,n,x,y;
main()
{
FILE *fin,*fout;
fin=fopen("climb.in","rb");
fout=fopen("climb.out","wb");
fscanf(fin,"%d",&n);
for(i=0;i<=n;i++)
fscanf(fin,"%d",&a[i]);
fscanf(fin,"%d",&m);
for(i=0;i<m;i++)
{
k=0;
fscanf(fin,"%d%d",&x,&y);
for(j=x;j<=y;j++)
{
if(k<=a[j])
k=a[j];
}
fprintf(fout,"%d",k);
fprintf(fout,"\n");
}
fclose(fin);
fclose(fout);
//system("pause");
}