So I made submission of problem https://codeforces.me/problemset/problem/154/B having submission 54472940 but giving tle on test case 1 while running efficiently and giving correct answer in codeblocks in my pc. Please help if there is any error in my code.









A little work in the custom test tool reveals that something is wrong with your logic that handles the cases that are preceded with the '-' character. It is possibly an infinite loop or undefined behavior. I am not going to spoil the fun of debugging for you. So I'll leave it to you to find out the root cause from here.
thanks, i will try it from my own
Just don't create static arrays locally ... create them globally with MAXN size i am refering to
bool vis[n]={false}; ll freq[n+1]={0}; set<ll> br[n+1];just move them to the global scope and make them like this
bool vis[MAXN]={false}; ll freq[MAXN]={0}; set<ll> br[MAXN];and get AC :)
Just remember that this is considered a very bad practice anywhere other than competitive programming though.
Thanks bro
I would remember that