Below is the link of the Question
my solution
https://www.codechef.com/viewsolution/42430995
If anyone can figure out What’s wrong with my code plz tell me .
Below is the link of the Question
my solution
https://www.codechef.com/viewsolution/42430995
If anyone can figure out What’s wrong with my code plz tell me .
Apparently the brute force solution got accepted and this one didn’t lol… 
I also got amazed by seeing the accepted solutions .
How ???
Also this solution didn’t get accepted , Isn’t it strange ?
I’ve just done a spot-check of the accepted solutions, and they all seem to use ints as the underlying type, rather than long long, raising the possibility that the Editorial solution is wrong (overflows) and so, in turn, are the testcases.
Maybe try again, without the #define ll long long.
Edit:
Or based on these two, it might just be that you have to have a line break after printing your array ![]()
#include <bits/stdc++.h>
#define ll long long
using namespace std ;
vector <ll> a(100005,0) ;
vector <ll> update(100010,0) ;
void print ( ll n ) {
ll count = 0 ;
for ( ll i = 1 ; i <= n ; i++ ) {
count += update[i] ;
cout << a[i]+count << " " ;
}
cout << '\n' ;
}
void Update ( ll l , ll r , ll x ) {
update[l] += x ;
update[r+1] -= x ;
}
void solve () {
ll n = 0 ;
cin >> n ;
for ( int i = 1 ; i <= n ; i++ ) {
cin >> a[i] ;
}
ll q = 0 ; cin >> q ;
string ls ;
ll l , r , x ;
for ( int i = 0 ; i < q ; i++ ) {
cin >> ls ;
if ( ls == "U" ) {
print ( n ) ;
}
else {
l = stoll(ls) ;
cin >> r >> x ;
Update ( l , r , x ) ;
}
}
update.assign(n+1,0) ;
}
int main()
{
int t = 0 ; cin >> t ;
while ( t-- ) {
solve() ;
}
return 0;
}