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

Автор Prvt, история, 5 лет назад, По-английски

I am getting runtime error on this problem https://codeforces.me/contest/3/problem/B on some ending test cases. My soultion is https://codeforces.me/contest/3/submission/55215191

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

»
5 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится
bool fuct(p a, p b){
	if(a.s >= b.s) return true;
	return false;
}

In short, your "true" condition is ambiguous: with two objects $$$a$$$ and $$$b$$$ having the same parameters $$$s$$$, both statements $$$a < b$$$ and $$$b < a$$$ is true (the comparator in sort function will return true if the first argument is considered "lower" than the second one), therefore either cause a TLE or reach maximum recursion depth by continuously swapping such elements.