https://codeforces.net/contest/810/problem/B see this problem and see my code https://pastebin.com/U3p3vCwD
my approach: i make pair,find maximum v[i].first and then check if second is >0 then multiply it.
if u dont understand my code just try to analyze my code.i think its pretty straightforward.