Блог пользователя aditya_patil71

Автор aditya_patil71, история, 9 дней назад, По-английски
  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
9 дней назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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

»
9 дней назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

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.