QOJ.ac

QOJ

Time Limit: 4 s Memory Limit: 512 MB Total points: 100

#11285. ZYPRESSEN

Statistics

给你一个长度为 $n$ 的序列 $a$,共有 $q$ 次询问,每次询问给你一个区间 $[l,r]$,求满足 $l\le i< j< k\le r$ 且 $2\max(a_i,a_j,a_k)< a_i+a_j+a_k$ 的三元组 $(i,j,k)$ 中 $a_i+a_j+a_k$ 的最小值。

输入格式

第一行两个整数 $n,q$。

第二行 $n$ 个整数 $a_{1\dots n}$。

接下来 $q$ 行,每行两个整数 $l,r$ 表示询问。

输出格式

$q$ 行,每行一个整数表示答案。

特别地,如果不存在符合条件的三元组,输出 yumi!

样例数据

样例 1 输入

7 6
3 11 1 5 12 19 10
1 1
3 5
2 5
1 7
2 6
1 4

样例 1 输出

yumi!
yumi!
28
24
28
yumi!

样例 2 输入

20 20
26 17 11 89 56 33 72 73 43 77 80 87 97 17 43 74 72 91 49 69
10 19
2 4
3 5
2 11
1 12
10 19
3 5
8 15
8 12
14 20
5 11
13 18
2 18
17 19
1 9
5 8
9 12
1 11
4 13
3 18

样例 2 输出

109
yumi!
yumi!
87
54
109
yumi!
103
193
109
132
163
45
212
54
161
200
54
132
87

子任务

Idea:critnos,Solution:critnos&zhoukangyang,Code:critnos,Data:critnos&Otomachi_Una_

所有数据保证 $1\le n\le 2.5\times 10^5$,$1\le q\le 5\times 10^5$,$1\le a_i\le 10^7$,$1\le l\le r\le n$。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.