• + 0 comments

    I have similar solution but it is giving timeout for some cases. why is it so? :

    include

    using namespace std;

    int main() { long int n,m; cin>>n>>m; long int arr[n] = {0}; for(long int i = 0;i>a>>b>>k; arr[a-1]+=k; if(b<=n) arr[b]-=k; } long int max = 0; long int s=0; for(long int i=0;imax) max = s; } cout<