Invitation to CodeChef June Starters 2021

We invite you to participate in CodeChef’s June Starters, this Sunday, 27th June.

Time: 4 PM - 7 PM IST.

Also, if you have some original and engaging problem ideas, and you’re interested in them being used in CodeChef’s contests, you can share them here.

Joining me on the problem setting panel are:

The video editorials of the problems will be available on our YouTube channel as soon as the contest ends. Subscribe to get notifications about our new editorials.

Hope to see you participating.

Good Luck!

1 Like

hello everyOne I have question regarding CodeChef: Practical coding for everyone this problem . here constraints are 1e5, so q can be max 1e5 and l can be 1 and r can be 1e5. so if we use n2 apporach it should get TLE. because for every q if l=1 and r=1e5 ,then in my apporach it will take n2 time .
but I got AC. Can you tell me what I am missing.
my apporach →

ll n,q;
   cin>>n>>q;
   vi<ll>arr(n,0);
   f(i,0,n)cin>>arr[i];
   while(q--){
    ll t;
    cin>>t;
    if(t==1){
        ll x,y,val;
        cin>>x>>y>>val;
        x--;
        y--;
        ll s=val*val;
        f(i,x,y+1){

            arr[i]+=(s);
            s=++val;
            s*=s;
            // printv(arr);
        }
    }
    else{
        ll y;
        cin>>y;
        y--;
        print(arr[y]);
    }
   }