您好,请问L题是数据水了吗

AC代码如下:

#include<bits/stdc++.h>
using namespace std;

using i64=long long;
using u64=unsigned long long;
using i128=__int128;
using u128=unsigned __int128;

void mktx()
{
	int n,m;
    cin>>n>>m;
    vector<int>a(n+1);
    for(int i=1;i<=n;i++) cin>>a[i];
    while(m--)
    {
        int op,l,r;
        cin>>op>>l>>r;
        if(op==1) a[l]=r;
        else
        {
            if(r-l+1<3) cout<<0<<'\n';
            else
            {
                int res=0;
                for(int i=l+1;i<r;i++) res+=(a[i]>max(a[i-1],a[i+1]));
                cout<<res<<'\n';
            }
        }
    }
} 
int main()
{
	ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
	//int t;cin>>t;
	int t=1;
	while(t--){
		mktx();
	}
	return 0;
}

全部评论
为什么改成longlong 或者是 把max改成if 就过不去了
点赞 回复 分享
发布于 03-30 22:56 河南

相关推荐

人生一梦:24年我投暑期实习,它以我不是女的为理由拒绝了我查看图片
点赞 评论 收藏
分享
03-02 02:44
门头沟学院 Java
咩咩子_:92直接梭哈
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务