Netherite_Pickaxe @ 2024-07-16 20:16:08
rt , 代码如下 , 求大佬们调
#include<bits/stdc++.h>
using namespace std;
int a[5000010];
inline void setup()
{
int lower=2147483647;
int n,p;
scanf("%d%d",&n,&p);
int x,y,z;
for(int i=1;i<=n;i+=1)
scanf("%d",&a[i]);
for(int i=1;i<=p;i+=1)
{
scanf("%d%d%d",&x,&y,&z);
for(int j=x;j<=y;j+=1)
{
a[j]+=z;
}
}
for(int i=1;i<=n;i+=1)
if(a[i]<=lower)
lower=a[i];
printf("%d",lower);
}
signed main()
{
setup();
exit(0);
}
by Down_syndrome @ 2024-07-19 10:10:58
你这暴力肯定超时啊,建议看题解或自行学习差分。