Problem Link:https://mirror.codeforces.com/contest/1779/problem/D Code Link:https://mirror.codeforces.com/contest/1779/submission/189809516
Logic i am using: first i am handling No case when v1[i]<v2[i], then i am storing count of all razors in a map. Now i iterate through 0 to n-1 and check if v1[i]>v2[i] if it so then i check if it the first time i have encountered this element, if yes then i need to use razor so i do mp[v2[i]]-- and update its position in other map, if it is not the first time then i range query from last position where i have seen that element to current position for max element. if it is greater than current element then i use razor an if it any moment mp[v2[i]] is required but it is 0 then i set bool flag var to false.