Need help in atcoder abc 139 E problem

Why my code is getting a TLE :
problem link : https://atcoder.jp/contests/abc139/tasks/abc139_e
my solution : https://atcoder.jp/contests/abc139/submissions/7286383