比赛 |
20120418s |
评测结果 |
AATTTTTT |
题目名称 |
山海经 |
最终得分 |
25 |
用户昵称 |
Citron酱 |
运行时间 |
0.000 s |
代码语言 |
C++ |
内存使用 |
0.00 MiB |
提交时间 |
2012-04-18 09:24:17 |
显示代码纯文本
#include <cstdio>
#define I_F "hill.in"
#define O_F "hill.out"
const long MAXn=100000;
int main()
{
long n,m,l,r,*s,ansl,ansr;
freopen(I_F,"r",stdin);
freopen(O_F,"w",stdout);
scanf("%ld%ld",&n,&m);
s=new long[n+1];
s[0]=0;
for (long i=1; i<=n; scanf("%ld",&s[i++]));
for (long i=2; i<=n; i++)
s[i]+=s[i-1];
for (long i=0; i<m; i++)
{
scanf("%d%d",&l,&r);
ansl=l, ansr=r;
for (long j=l; j<=r; j++)
for (long k=j; k<=r; k++)
if (s[k]-s[j-1]>s[ansr]-s[ansl-1])
ansl=j, ansr=k;
printf("%ld %ld %ld\n",ansl,ansr,s[ansr]-s[ansl-1]);
}
return 0;
}