| 14 | |
| 15 | |
| 16 | int main() { |
| 17 | long int N,K,p,q,sum,i,j,max=0,x=0; |
| 18 | |
| 19 | cin>>N>>K; |
| 20 | long int *a=new long int[N+1](); |
| 21 | |
| 22 | for(i=0;i<K;i++) |
| 23 | { |
| 24 | cin>>p>>q>>sum; |
| 25 | a[p]+=sum; |
| 26 | if((q+1)<=N) a[q+1]-=sum; |
| 27 | } |
| 28 | |
| 29 | for(i=1;i<=N;i++) |
| 30 | { |
| 31 | x=x+a[i]; |
| 32 | if(max<x) max=x; |
| 33 | |
| 34 | } |
| 35 | |
| 36 | cout<<max; |
| 37 | return 0; |
| 38 | } |
nothing calls this directly
no outgoing calls
no test coverage detected