aditya_patil71's blog

By aditya_patil71, history, 7 days ago, In English
»
7 days ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it
»
7 days ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by aditya_patil71 (previous revision, new revision, compare).

»
7 days ago, # |
Rev. 2   Vote: I like it 0 Vote: I do not like it

You can refer to my solution https://codeforces.com/contest/1980/submission/265876558

the idea is simple we iterate through the indexes and for every index where a[i]!=b[i] we just check if there exists b[i] in the replacement queries if found we simply decrease the count of b[i] in the replacement queries, else we output NO. In the end we also have to check that the last query actually exists in the array "b" or not as we have to execute that too and if we execute a query on array "a" which is not present in "b" then the arrays would differ that's why we check that and print YES or NO accordingly.