80,一个WA求救(@我)

P2367 语文成绩

ammdyc @ 2023-09-29 16:30:48

代码如下


#include<bits/stdc++.h>
using namespace std;
const int mmmm=5e6; 
int n,m,a[mmmm],x,y,z,c[mmmm],b[mmmm];
int main(){
    cin>>n>>m; 
    for(int i=1;i<=n;i++){
        cin>>a[i];
        c[i]=a[i]-a[i-1];
    }
    for(int i=1;i<=m;i++){
        cin>>x>>y>>z;
        c[x]+=z;
        c[y+1]-=z;
    } 
    int minn=9999999;
    for(int i=1;i<=n;i++){
        b[i]=b[i-1]+c[i];
        if(minn>b[i]){
            minn=b[i];
        }
    }
    cout<<minn;
    return 0;
}

by thinkerliu @ 2023-09-29 16:44:15

把所有b数组改为a数组


by thinkerliu @ 2023-09-29 16:45:05

已过


by thinkerliu @ 2023-09-29 16:45:38

80纯粹巧合


by thinkerliu @ 2023-09-29 16:45:58

@ammdyc


|