日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Feel Good

發布時間:2025/3/15 编程问答 20 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Feel Good 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

傳送門

?

Time Limit:?3000MS?Memory Limit:?65536K
Total Submissions:?14435?Accepted:?3996
Case Time Limit:?1000MS?Special Judge

Description

Bill is developing a new mathematical theory for human emotions. His recent investigations are dedicated to studying how good or bad days influent people's memories about some period of life.?

A new idea Bill has recently developed assigns a non-negative integer value to each day of human life.?

Bill calls this value the emotional value of the day. The greater the emotional value is, the better the daywas. Bill suggests that the value of some period of human life is proportional to the sum of the emotional values of the days in the given period, multiplied by the smallest emotional value of the day in it. This schema reflects that good on average period can be greatly spoiled by one very bad day.?

Now Bill is planning to investigate his own life and find the period of his life that had the greatest value. Help him to do so.

Input

The first line of the input contains n - the number of days of Bill's life he is planning to investigate(1 <= n <= 100 000). The rest of the file contains n integer numbers a1, a2, ... an ranging from 0 to 106?- the emotional values of the days. Numbers are separated by spaces and/or line breaks.

Output

Print the greatest value of some period of Bill's life in the first line. And on the second line print two numbers l and r such that the period from l-th to r-th day of Bill's life(inclusive) has the greatest possible value. If there are multiple periods with the greatest possible value,then print any one of them.

Sample Input

6 3 1 6 4 5 2

Sample Output

60 3 5

Source

Northeastern Europe 2005 【解析】 題目大意:找一個區間,區間的和乘以區間的最小值最大。 暴力一定超時。 我們可以對于每一個元素a[i],找到一個盡可能大的區間,使a[i]成為這個區間的最小值。 用sum數組存前綴和,最后枚舉區間即可。 注意long long 【code】 #include<iostream> #include<cstdio> using namespace std; #define N 100050 long long sum[N],l[N],r[N],a[N]; long long n,L,R; long long ans,maxx=-1; int main() {scanf("%d",&n);for(int i=1;i<=n;i++){scanf("%lld",&a[i]);l[i]=r[i]=i;sum[i]=sum[i-1]+a[i];}a[0]=a[n+1]=-1;for(int i=1;i<=n;i++){while(a[i]<=a[l[i]-1])l[i]=l[l[i]-1];}for(int i=n;i>=1;i--){while(a[i]<=a[r[i]+1])r[i]=r[r[i]+1];}for(int i=1;i<=n;i++){ans=(sum[r[i]]-sum[l[i]-1])*a[i];if(ans>maxx){maxx=ans;L=l[i];R=r[i];}}printf("%lld\n%lld %lld",maxx,L,R);return 0; }

?

轉載于:https://www.cnblogs.com/zzyh/p/6852056.html

總結

以上是生活随笔為你收集整理的Feel Good的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 免费在线视频一区二区 | 中文字幕69 | 免费aa视频 | 色多多在线视频 | 国产女人18毛片水真多1 | 国产欧美视频在线播放 | 亚洲一级片 | 亚洲女优在线 | 特黄一级毛片 | 欧美一级片一区 | 韩国一级淫片免费看 | 国产精品视频一二区 | 在线观看免费视频黄 | 小妹色播 | 色先锋影院 | 欧美女优在线 | 欧美粉嫩videosex极品 | 亚洲 欧美 另类 综合 偷拍 | 黄色免费在线网站 | 久久五月激情 | 日韩激情在线视频 | 欧美精品videos另类 | 久久精品www人人爽人人 | 在线看中文字幕 | 国产精品免费网站 | 国产成人精品一区二区三区免费 | 国产福利电影在线 | 亚洲欧美www| 午夜精品久久久久久久久久久久久蜜桃 | 午夜91视频 | 嫩草研究院在线观看 | 色综合天 | 国产在线看| 国产精品7 | 亚洲香蕉一区 | 亚洲欧美一区二区在线观看 | 第一次破处视频 | 毛片大全 | 日本不卡免费 | 国产三级做爰高清在线 | 四虎最新网址在线观看 | 天天爽网站 | 国产精品久久一区二区三区 | 中国zzji女人高潮免费 | 6080午夜| 日本熟妇一区二区三区四区 | 欧美三日本三级少妇三 | 午夜av免费在线观看 | 久久精品黄aa片一区二区三区 | 你懂的在线播放 | 国产在线视频资源 | 亚洲三级中文字幕 | 亚洲一区二区三区电影 | 老牛av一区二区 | 精品国产精品国产偷麻豆 | 激情开心成人网 | 毛片成人网 | 最新中文字幕第一页 | 日本在线视频一区二区三区 | 九九热伊人 | 久久综合爱 | 日日夜夜撸啊撸 | 伊人免费在线 | 小伸进喷水网站 | 欧美人妻精品一区二区免费看 | 99精品久久毛片a片 成人网一区 | 久久亚洲区 | www.香蕉视频 | www.波多野结衣.com | 内射后入在线观看一区 | 97超碰人人| 色综合久久久无码中文字幕波多 | 你懂的日韩 | 欧美一区二三区 | 白嫩情侣偷拍呻吟刺激 | 最近中文字幕在线免费观看 | 黄页网站在线播放 | 三级黄色网 | 国产第一页第二页 | 日本不卡一区二区三区在线观看 | 99热在线免费观看 | 精品国产一区二区三区久久久蜜臀 | 日韩av在线一区二区三区 | 肥婆大荫蒂欧美另类 | 五月婷婷综合色 | 欧美激情成人 | 日本性xxxxx 免费毛片视频网站 | 欧美极品一区二区 | 精品一区二区三区无码按摩 | 一级黄色影院 | 日本美女黄色一级片 | 日韩av不卡在线 | 视频一区二区三区在线 | 天天爽天天搞 | 国产情侣一区二区 | 日日爱669 | 久久中文视频 | 日韩精品xxxx | 狠狠干2018|