ahshafi's blog

By ahshafi, history, 2 years ago, In English

In 1681C - Double Sort of last Educational , I sorted the vector {0, 1, .... n-1} using the following comparison function

bool comp(int &i, int &j)
{
	return a[i]<=a[j] and b[i]<=b[j];
}

This resulted in RTE. Submission link

Then I used a tuple vector of (a[i], b[i] , i) instead and sorted it with default STL comparator which however gave AC. Submission link Has it something to do with the comparator?

  • Vote: I like it
  • -11
  • Vote: I do not like it

»
2 years ago, # |
  Vote: I like it +11 Vote: I do not like it