Problem 2612 --Basic Operations - Min-Max Element

2612: Basic Operations - Min-Max Element

"
Time Limit $1$ 秒/Second(s) Memory Limit $512$ 兆字节/Megabyte(s)
提交总数 $221$ 正确数量 $155$
裁判形式 标准裁判/Standard Judge 我的状态 尚未尝试
难度 分类标签 STL
Write a program which manipulates a sequence A={a0,a1,...,an−1} by the following operations: min(b,e): report the minimum element in ab,ab+1,...,ae−1 max(b,e): report the maximum element in ab,ab+1,...,ae−1
The input is given in the following format. n a0 a1,...,an−1 q com1 b1 e1 com2 b2 e2 : comq bq eq In the first line, n (the number of elements in A) is given. In the second line, ai (each element in A) are given. In the third line, the number of queries q is given and each query is given in the following q lines. comi denotes a type of query. 0 and 1 represents min(b,e) and max(b,e) respectively.
For each query, print the minimum element or the maximum element in a line.
7
8 3 7 1 9 1 4
3
0 0 3
0 1 5
1 0 7
3
1
9
1≤n≤1,000 −1,000,000,000≤ai≤1,000,000,000 1≤q≤1,000 0≤b

推荐代码 查看2612 所有题解 上传题解视频得图灵币

本题记录 用 户(点击查看用户) 运行号(点击购买题解) 时 间
算法最快[$0 $ms] AOJ大管家 436640 2019-06-05 23:43:15
内存最少[$2020 $KB] 卑微小赵 386569 2019-03-26 20:03:49
第一AC 计爱玲 281533 2018-10-07 10:38:58
第一挑战 计爱玲 281533 2018-10-07 10:38:58

赛题来源/所属竞赛 会津大学《C++ Programming II》 C++程序设计(高级)

竞赛编号 竞赛名称 竞赛时间 访问比赛
1680 2021-2022-2学期<算法分析与设计> 第1周练习:STL容器1:vetor/list/queue/deque/sort 2022-02-21 08:00:00 请登录