fzu 2136
#include<stdio.h>
#define inf 1000000000
#define N 110000
int a[N];
struct node {
int start,end;
}b[N];
int minn[N];
int main() {
int n,t,i,j,len;
scanf("%d",&t);
while(t--){
scanf("%d",&n);
for(i=1;i<=n;i++) {
scanf("%d",&a[i]);
minn[i]=inf;
}
for(i=1;i<=n;i++) {
for(j=i-1;j>=1;j--)
if(a[j]>a[i])break;
b[i].start=j+1;
for(j=i+1;j<=n;j++)
if(a[j]>a[i])break;
b[i].end=j-1;
}
for(i=1;i<=n;i++) {
len=b[i].end-b[i].start+1;
for(j=1;j<=len;j++)
if(minn[j]>a[i])
minn[j]=a[i];
}
for(i=1;i<=n;i++)
printf("%d\n",minn[i]);
}
return 0;
}
fzu 2136的更多相关文章
- fzu 2136 取糖果 好几种方法解决。
Problem 2136 取糖果 Accept: 39 Submit: 101 Time Limit: 1000 mSec Memory Limit : 32768 KB Problem ...
- FZU Problem 2136 取糖果
Problem 2136 取糖果 Time Limit: 1000 mSec Memory Limit : 32768 KB Problem Description 有N个袋子放成一排,每个 ...
- Problem 2136 取糖果---FUOJ (线段树+维护)
http://acm.fzu.edu.cn/problem.php?pid=2136 题目大意: 给你n个袋子每个袋子里都装有糖果,然后呢你可以每次抽取一个连续的一个区间的袋子,然后带走里面最多糖果数 ...
- FZU 2137 奇异字符串 后缀树组+RMQ
题目连接:http://acm.fzu.edu.cn/problem.php?pid=2137 题解: 枚举x位置,向左右延伸计算答案 如何计算答案:对字符串建立SA,那么对于想双延伸的长度L,假如有 ...
- FZU 1914 单调队列
题目链接:http://acm.fzu.edu.cn/problem.php?pid=1914 题意: 给出一个数列,如果它的前i(1<=i<=n)项和都是正的,那么这个数列是正的,问这个 ...
- ACM: FZU 2105 Digits Count - 位运算的线段树【黑科技福利】
FZU 2105 Digits Count Time Limit:10000MS Memory Limit:262144KB 64bit IO Format:%I64d & ...
- FZU 2112 并查集、欧拉通路
原题:http://acm.fzu.edu.cn/problem.php?pid=2112 首先是,票上没有提到的点是不需要去的. 然后我们先考虑这个图有几个连通分量,我们可以用一个并查集来维护,假设 ...
- ACM: FZU 2107 Hua Rong Dao - DFS - 暴力
FZU 2107 Hua Rong Dao Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I6 ...
- ACM: FZU 2112 Tickets - 欧拉回路 - 并查集
FZU 2112 Tickets Time Limit:3000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u P ...
随机推荐
- 使用SetTimer函数为Delphi的Win控件设置时钟
procedure Timertodo(var messag:Tmessage);message WM_TIMER; procedure TForm1.FormCreate(Sender: TObje ...
- ext4文件系统制作 - make_ext4fs 参数介绍【转】
本文转载自:http://blog.csdn.net/u011784994/article/details/53816976 make_ext4fs用于Android平台上制作ext4文件系统的镜像. ...
- curses-键盘编码-openssl加解密【转】
本文转载自;https://zhuanlan.zhihu.com/p/26164115 1.1 键盘编码 按键过程:当用户按下某个键时, 1.键盘会检测到这个动作,并通过键盘控制器把扫描码(scan ...
- 使用powershell来设置时间
https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/set-date?view=powers ...
- hdu 4704(费马小定理+快速幂取模)
Sum Time Limit: 2000/ ...
- BKDRHash 算法 php 版本( 可用于 字符串 hash 为int 转)
<?php function BKDRHash($str) { $seed = 131; // 31 131 1313 13131 131313 etc.. $hash = 0; $cnt = ...
- poj2975 Nim(经典博弈)
Nim Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 5866 Accepted: 2777 Description N ...
- F - Modular Exponentiation
Problem description The following problem is well-known: given integers n and m, calculate 2n mod m, ...
- hbase无法启动,The node /hbase is not in ZooKeeper
问题详细描述如下: 2016-12-09 15:10:39,160 ERROR [org.apache.hadoop.hbase.client.ConnectionManager$HConnectio ...
- Xcode控制台输出中文
创建一个.m文件,然后将一下代码加入.m文件中即可实现控制台输出中文,具体代码如下: #ifndef Release @implementation NSSet(Log) - (NSString *) ...