……
by qwq自动机 @ 2021-08-24 13:18:30
```cpp
inline int read()
{
int x=0,f=1;char ch=getchar();
while (ch<'0'||ch>'9'){if (ch=='-') f=-1;ch=getchar();}
while (ch>='0'&&ch<='9'){x=x*10+ch-48;ch=getchar();}
return x*f;
}
```
可是他就写在题里
by miserExist @ 2021-08-24 13:18:36
@[miserExist](/user/49677) 可是用```cout```会T飞
by Error_Yuan @ 2021-08-24 13:19:21
这种输出多的本来就要printf吧。。。
by Dimly_dust @ 2021-08-24 13:20:19
@[Error_Yuan](/user/358748)
```sb
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
```
by little_cindy @ 2021-08-24 13:20:51
我用 cin&cout 也 A 了啊。。。
```cpp
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cmath>
#include<string>
#include<cstring>
#include<iomanip>
#include<vector>
#define IOS ios_base::sync_with_stdio(0); cin.tie(0);
using namespace std;
#define inf 0x3f3f3f3f
#define int long long
#define endl '\n'
const int maxn = 1000010;
int n, m, a[maxn], dp[maxn][25], l, r;
void prepare() {
cin >> n >> m;
for (int i = 1;i <= n;i++) {
cin >> a[i];
dp[i][0] = a[i];
}
for (int j = 1;(1 << j) <= n;j++) {
for (int i = 1;i + (1 << j) - 1 <= n;i++) {
dp[i][j] = max(dp[i][j - 1], dp[i + (1 << (j - 1))][j - 1]);
}
}
}
int query(int l, int r) {
int i = (int)(log2(r - l + 1));
return max(dp[l][i], dp[r - (1 << i) + 1][i]);
}
signed main() {
IOS;
prepare();
for (int i = 1;i <= m;i++) {
cin >> l >> r;
cout << query(l, r) << endl;
}
return 0;
}
//Fununugugu Code
```
by int64 @ 2021-08-24 13:22:00
@[little_cindy](/user/357311) 实测```cout```再怎么优化还是在 $80pts$ 以内
by Error_Yuan @ 2021-08-24 13:22:45
这波啊,这波是```endl```的锅...
by Error_Yuan @ 2021-08-24 13:24:29
我他妈自始至终都是cin/cout 一点没T!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!11
by int32 @ 2021-08-24 13:29:31
@[int64](/user/360331) @[int32](/user/142548) 惊现双`int`
by syanoeclipse @ 2021-09-27 19:13:25