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

Автор trgt26, история, 16 месяцев назад, По-английски

In this problem, I have used a comparator function named "checking", for this, it is giving runtime error. But if i use another comparator function named "checking2" then it gets accepted. But these two comparator function is almost same. Why is it giving runtime error for "checking" function? please help.

Problem Link: https://codeforces.me/contest/1846/problem/C

Accepted code with checking comparator: https://codeforces.me/contest/1846/submission/212708795

Runtime error code with cheking2 comparator: https://codeforces.me/contest/1846/submission/212720506

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
16 месяцев назад, # |
  Проголосовать: нравится +6 Проголосовать: не нравится

https://codeforces.me/blog/entry/70237

TL;DR: Comparators must return false when comparing equal elements. Your function checkingdoes this, checking2 doesn't.