Put function please explain code is given as link a video link is there to explain the solution i have mentioned its link also

https://codeforces.com/contest/1118/submission/50541968

This solution is of codeforces round 540 div 3 palindromic sring

question above link is the solution for it i want to understand a part of it not whole code explanation is requierd

i want to understand in solution put function also please tell about t(q.top) meaning i want havevery less experince with stl so please explain in a layman’s language

i have understood int main code


this link tells about the code solution you can have a look to understand his solution which i have mentioned the first link is the code for it

it s palindromic matrix question you can search on internet was asked on codeforces

Please any ta respond please if you havent understood my doubt please reply i will try to make it clear

Hey @AyushKumar9032
I read the solution
In the put function the only complex part seems to be the first line rest I believe you can understand very easily

auto t(q.top());
So auto means you don’t need to define type of the variable
System determines the data type of the variable itself
Now your q is a Priority Queue of type <int,int>
If you do pair<int,int> p(q.top());
p becomes a copy of q.top() element
Now instead of pair<int,int> you can do auto
so it becomes auto p(q.top())

If your doubt is resolved please close it

please also explain

if (t.first < pos.size())
how will pos.size value be evaluated please explain that

@AyushKumar9032
So a pair<int,int> has 2 values
You access them using p.first and p.second
and pos.size() gives length of vector
So you’re comparing first value in pair t with length of pos vector

1 Like

@AyushKumar9032
If your doubt is resolved and you haven’t already then please close the doubt

i marked it
5 min earlier please check once again and then tell

1 Like

@AyushKumar9032
Great. Thanks.