Its just showing compilation succesful

@chemant077,

  • Line 71: vector<int>v(n);
  • Correction: vector<int>v; -> Because you are using push_back when taking input.

  • Line 87: ans=(ans%mod+((i.second)+1)%mod)%mod;
  • Correction: ans=((ans % mod) * ((i.second) + 1) % mod) % mod;

  • Also cout<<ans<<endl; should be after the for loop not inside it.

Line 71: vectorv(n); how to take input when the vector is in this format

also its showing wrong answer is there anything wrong with my logic implementation as explained in hint

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.