20pts,只有#2AC,求调,玄关

P2367 语文成绩

WJX114514 @ 2025-01-11 11:42:10

#include<bits/stdc++.h>
using namespace std;
const int maxn=5e6+10;
int a[maxn],b[maxn];
int n,m;
int main(){
    memset(b,0,sizeof(b));
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i];
        b[i]=a[i]-a[i-1];
    }
    for(int i=1;i<=m;i++){
        int x,y,z; cin>>x>>y>>z;
        b[x]+=x; b[y+1]-=x;
    }
    int ans=0x7f7f7f7f;
    for(int i=1;i<=n;i++){
        b[i]=b[i-1]+b[i];
        ans=min(b[i],ans);
    }
    cout<<ans;
    return 0;
}

by light_searcher @ 2025-01-11 11:50:55

@WJX114514 您把 z 打成 x


by WJX114514 @ 2025-01-11 12:17:05

OK,感谢,已关@light_searcher


|