WA in WANNABET (was TLE)

https://www.codechef.com/viewsolution/36564156

can’t understand why TLE.

since second dimention has 26 elements only…Can’t seem logical to optimize it.

ll sum(vector<vector<ll>> bit, ll r, ll idy) {

Try passing bit by reference.

3 Likes

It works but problem is why it is giving wrong
https://www.codechef.com/viewsolution/36564688

I spend my whole day figuring and develping solution , please help brother

1 Like

I just tried Make BIT for every alphabet and store in a array , and then transverse simply to figure it out which one is required for query